package ylsb.service;


import jxl.Workbook;
import jxl.format.UnderlineStyle;
import jxl.write.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import ylsb.controller.YiyongijieguoController;
import ylsb.dao.*;
import ylsb.model.*;
import ylsb.support.BatchupdateBankRecordThread;
import ylsb.support.JsonResult;
import ylsb.support.StringHandle;
import ylsb.support.BatchInsertBankRecordThread;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.Boolean;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

@Service
public class YltpjieguoService {
    
    @Resource
    YltpJieguoMapper ddMapper;
    @Resource
    HcjieguoMapper hcjieguoMapper;
    @Resource
    YiyongyuanzeMapper yiyongyuanzeMapper;
    @Resource
    DailiangchuangxinMapper ddDailiangchuangxinMapper;
    @Resource
    DailiangchuangxinService ddDailiangchuangxinService;
    @Resource
    ShebeiService ddShebeiService;
    @Resource
    YltpyinjinService ddYltpyinjinService;
    @Resource
    YltpbaofeiService ddYltpbaofeiService;
    @Resource
    YltpuserService ddYltpuserService;
    @Resource
    YltpXiangmuService ddYltpXiangmuService;
    @Resource
    YltpjieguoService ddService;
    @Resource
    YltprenyuanfenpeiService ddYltprenyuanfenpeiService;

    @Resource
    Hc2Mapper hc2Mapper;
    @Resource
    Hc3Mapper hc3Mapper;
    @Resource
    Hc45Mapper  hc45Mapper;
    @Resource
    YltpJieguoMapper yltpJieguoMapper;

    public Integer getChuangxinchanpinResultCount(String mmxiangmuId,String mmuserId,String mmresult){
        Object mmCount = ddMapper.getChuangxinchanpinResultCount(mmxiangmuId,mmuserId,mmresult);
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }
    public Integer getBaofeiResultCount(String mmxiangmuId,String mmuserId,String mmresult){
        Object mmCount = ddMapper.getBaofeiResultCount(mmxiangmuId,mmuserId,mmresult);
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }
    public Integer getYinjinResultCount(String mmxiangmuId,String mmuserId,String mmresult){
        Object mmCount = ddMapper.getYinjinResultCount(mmxiangmuId,mmuserId,mmresult);
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }
    public Integer getShebeiResultCount(String mmxiangmuId,String mmuserId,String mmresult){
        Object mmCount = ddMapper.getShebeiResultCount(mmxiangmuId,mmuserId,mmresult);
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }
    public Integer getResultCount(String mmxiangmuId,String mmxiangmuleixing,String mmuserId,String mmresult){
        String tablename="";
        String fromtablename="";
        switch (mmxiangmuleixing){
            case "18":fromtablename=new String("yltp_jieguo");break;
            case "19":fromtablename=new String("yltp_jieguo");break;
            case "20":fromtablename=new String("yltp_jieguo");break;
            case "21":fromtablename=new String("hcjieguo");break;
            case "22":fromtablename=new String("hcjieguo");break;
            case "23":fromtablename=new String("yltp_jieguo");break;
            case "24":fromtablename=new String("yltp_jieguo");break;
            case "25":fromtablename=new String("hcjieguo");break;
            case "26":fromtablename=new String("hcjieguo");break;
            case "27":fromtablename=new String("hcjieguo");break;
            case "28":fromtablename=new String("hcjieguo");break;
            case "29":fromtablename=new String("hcjieguo");break;
        }
        Object mmCount = ddMapper.getResultCount(mmxiangmuId,Tablename.getTablename(mmxiangmuleixing),mmuserId,mmresult,fromtablename);
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }
    public Integer getHaocaiduibiaoResultCount(String mmxiangmuId,String mmuserId,String mmresult){
        Object mmCount = ddMapper.getHaocaiduibiaoResultCount(mmxiangmuId,mmuserId,mmresult);
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }
    public Integer getZhuankeyinjinResultCount(String mmxiangmuId,String mmuserId,String mmresult){
        Object mmCount = ddMapper.getZhuankeyinjinResultCount(mmxiangmuId,mmuserId,mmresult);
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }
    public Integer getCountBydetailIdandResult(String mmdetailId,String mmresult){
        YltpJieguoExample mmExample=new YltpJieguoExample();
        YltpJieguoExample.Criteria criteria = mmExample.createCriteria();
        criteria.andDetailidEqualTo(mmdetailId).andResultEqualTo(mmresult);
        List<YltpJieguo> jieguo = ddMapper.selectByExample(mmExample);
        return jieguo==null?0:jieguo.size();
    }
    public YltpJieguo checkexistBydetailanduserId(String ppId,String ppuserId){
        YltpJieguoExample mmExample=new YltpJieguoExample();
        YltpJieguoExample.Criteria criteria = mmExample.createCriteria();
        criteria.andDetailidEqualTo(ppId).andUseridEqualTo(ppuserId);
        return ddMapper.selectByExample(mmExample).size()>0? ddMapper.selectByExample(mmExample).get(0):
                null;
    }
    public boolean add(YltpJieguo ppYltpJieguo){
        return ddMapper.insert(ppYltpJieguo)==1;
    }
    public boolean modify(YltpJieguo ppYltpJieguo){
        return ddMapper.updateByPrimaryKeySelective(ppYltpJieguo)==1;
    }
    //设备签字表
    public void shebeiqianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                 @RequestParam("userid") String ppuserid,
                                 HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList=ddShebeiService.findBiaojuelist(ppxiangmuid,ppuserid);
        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,680); //第一行高度
            wsheet.mergeCells(0, 0, 11, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,10); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,20); //宽度



            // 内容头部开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 第二行不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 2, 1);

            wsheet.addCell(new Label(6, 1, "签名："+mmusername,wcfFC2));
            wsheet.mergeCells(6, 1, 11, 1);

            wsheet.addCell(new Label(0, 2, "院区",wcfFC));
            wsheet.addCell(new Label(1, 2, "序号",wcfFC));
            wsheet.addCell(new Label(2, 2, "使用科室",wcfFC));
            wsheet.addCell(new Label(3, 2, "设备名称",wcfFC));
            wsheet.addCell(new Label(4, 2, "型号",wcfFC));
            wsheet.addCell(new Label(5, 2, "台件数",wcfFC));
            wsheet.addCell(new Label(6, 2, "生产厂家",wcfFC));
            wsheet.addCell(new Label(7, 2, "序列号",wcfFC));
            wsheet.addCell(new Label(8, 2, "启用时间",wcfFC));
            wsheet.addCell(new Label(9, 2, "设备投放公司",wcfFC));
           /* wsheet.addCell(new Label(10, 2, "现产权归属",wcfFC));*/
            wsheet.addCell(new Label(10, 2, "问题类别",wcfFC));
          /*  wsheet.addCell(new Label(12, 2, "理由",wcfFC));*/
            wsheet.addCell(new Label(11, 2, "表决意见",wcfFC));
            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int mmKaishihang=3;

            for(int i=0;i<mmList.size();i++){
                Map<String,Object> mmMap=mmList.get(i);
                String mmXuhao = String.valueOf(i + 1);
                String mmYuanqu = mmMap.get("yuanqu")==null ? "" :mmMap.get("yuanqu").toString();
                String mmshiyongkeshi=mmMap.get("shiyongkeshi")==null ? "" :mmMap.get("shiyongkeshi").toString();
                String mmshebeimingcheng=mmMap.get("shebeimingcheng")==null ? "" :mmMap.get("shebeimingcheng").toString();
                String mmxinghao=mmMap.get("xinghao")==null ? "" :mmMap.get("xinghao").toString();
                String mmtaijianshu=mmMap.get("taijianshu")==null ? "" :mmMap.get("taijianshu").toString();
                String mmshengchanchangshang=mmMap.get("shengchanchangshang")==null ? "" :mmMap.get("shengchanchangshang").toString();
                String mmxuliehao=mmMap.get("xuliehao")==null ? "" :mmMap.get("xuliehao").toString();
                String mmqiyongshijian=mmMap.get("qiyongshijian")==null ? "" :mmMap.get("qiyongshijian").toString();
                String mmshebeigongsi=mmMap.get("shebeigongsi")==null ? "" :mmMap.get("shebeigongsi").toString();
                String mmguishu=mmMap.get("guishu")==null ? "" :mmMap.get("guishu").toString();
                String mmleibie=mmMap.get("leibie")==null ? "" :mmMap.get("leibie").toString();
                String mmliyou=mmMap.get("liyou")==null ? "" :mmMap.get("liyou").toString();
                String mmresult=mmMap.get("result")==null ? "" :mmMap.get("result").toString();
                String mmbiaojueren=mmMap.get("username")==null ? "" :mmMap.get("username").toString();
                String mmyijian="";
                if("1".equals(mmresult)){
                    mmyijian="同意";
                }else if("0".equals(mmresult)){
                    mmyijian="不同意";
                }else {
                    mmyijian="未表决";
                }
                wsheet.setRowView(mmKaishihang, 760); //第三行高度
                wsheet.addCell(new Label(0, mmKaishihang,mmYuanqu,wcfFC));
                wsheet.addCell(new Label(1, mmKaishihang,mmXuhao,wcfFC));
                wsheet.addCell(new Label(2, mmKaishihang,mmshiyongkeshi,wcfFC));
                wsheet.addCell(new Label(3, mmKaishihang,mmshebeimingcheng,wcfFC));
                wsheet.addCell(new Label(4, mmKaishihang,mmxinghao,wcfFC));
                wsheet.addCell(new Label(5, mmKaishihang,mmtaijianshu,wcfFC));
                wsheet.addCell(new Label(6, mmKaishihang,mmshengchanchangshang,wcfFC));
                wsheet.addCell(new Label(7, mmKaishihang,mmxuliehao,wcfFC));
                wsheet.addCell(new Label(8, mmKaishihang,mmqiyongshijian,wcfFC));
                wsheet.addCell(new Label(9, mmKaishihang,mmshebeigongsi,wcfFC));
              /*  wsheet.addCell(new Label(10, mmKaishihang,mmguishu,wcfFC));*/
                wsheet.addCell(new Label(10, mmKaishihang,mmleibie,wcfFC));
               /* wsheet.addCell(new Label(12, mmKaishihang,mmliyou,wcfFC));*/
                wsheet.addCell(new Label(11, mmKaishihang,mmyijian,wcfFC));
                mmKaishihang = mmKaishihang+1;


            }
            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    //引进签字表
    public void yinjinqianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                 @RequestParam("userid") String ppuserid,
                                 HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList=ddYltpyinjinService.findBiaojuelist(ppxiangmuid,ppuserid);
        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,500); //第一行高度
            wsheet.setRowView(1,500); //第一行高度
            wsheet.mergeCells(0, 0, 8, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,6); //宽度
            wsheet.setColumnView(1,22); //宽度
            wsheet.setColumnView(2,33); //宽度
            wsheet.setColumnView(3,33); //宽度
            wsheet.setColumnView(4,6); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 2, 1);

            wsheet.addCell(new Label(3, 1, "签名："+mmusername,wcfFC2));
            wsheet.mergeCells(3, 1, 5, 1);

            wsheet.addCell(new Label(6, 1, "单位：万元",wcfFC2));
            wsheet.mergeCells(6, 1, 8, 1);

            wsheet.addCell(new Label(0, 2, "序号",wcfFC));
            wsheet.addCell(new Label(1, 2, "科室名称",wcfFC));
            wsheet.addCell(new Label(2, 2, "设备名称",wcfFC));
            wsheet.addCell(new Label(3, 2, "通用名称",wcfFC));
            wsheet.addCell(new Label(4, 2, "数量",wcfFC));
            wsheet.addCell(new Label(5, 2, "预算单价",wcfFC));
            wsheet.addCell(new Label(6, 2, "预算金额",wcfFC));
            wsheet.addCell(new Label(7, 2, "选择理由",wcfFC));
            wsheet.addCell(new Label(8, 2, "表决建议",wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int mmKaishihang=3;

            for(int i=0;i<mmList.size();i++){
                Map<String,Object> mmMap=mmList.get(i);
                String mmXuhao = String.valueOf(i + 1);
                String mmshiyongkeshi=mmMap.get("shiyongkeshi")==null ? "" :mmMap.get("shiyongkeshi").toString();
                String mmshebeimingcheng=mmMap.get("shebeimingcheng")==null ? "" :mmMap.get("shebeimingcheng").toString();
                String mmshuliang=mmMap.get("shuliang")==null ? "" :mmMap.get("shuliang").toString();
                String mmdanjia=mmMap.get("danjia")==null ? "" :mmMap.get("danjia").toString();
                String mmyusuanjine=mmMap.get("yusuanjine")==null ? "" :mmMap.get("yusuanjine").toString();
                String mmshebeileixing=mmMap.get("shebeileixing")==null ? "" :mmMap.get("shebeileixing").toString();
                String mmtongyongmingcheng=mmMap.get("tongyongmingcheng")==null ? "" :mmMap.get("tongyongmingcheng").toString();
                String mmbeizhu=mmMap.get("beizhu")==null ? "" :mmMap.get("beizhu").toString();
                String mmresult=mmMap.get("result")==null ? "" :mmMap.get("result").toString();
                String mmbiaojueren=mmMap.get("username")==null ? "" :mmMap.get("username").toString();
                String mmshiyongyuanzeid=mmMap.get("shiyongyuanzeid")==null ? "" :mmMap.get("shiyongyuanzeid").toString();
                String mmyijian="";
                if("1".equals(mmresult)){
                    mmyijian="同意";
                }else if("0".equals(mmresult)){
                    mmyijian="不同意";
                }else {
                    mmyijian="未表决";
                }
                wsheet.setRowView(mmKaishihang,660); //第三行高度
                wsheet.addCell(new Label(0, mmKaishihang,mmXuhao,wcfFC));
                wsheet.addCell(new Label(1, mmKaishihang, mmshiyongkeshi,wcfFC));
                wsheet.addCell(new Label(2, mmKaishihang,mmshebeimingcheng,wcfFC));
                wsheet.addCell(new Label(3, mmKaishihang,mmtongyongmingcheng,wcfFC));
                wsheet.addCell(new Label(4, mmKaishihang,mmshuliang,wcfFC));
                wsheet.addCell(new Label(5, mmKaishihang,mmdanjia,wcfFC));
                wsheet.addCell(new Label(6, mmKaishihang,mmyusuanjine,wcfFC));
                wsheet.addCell(new Label(7, mmKaishihang,mmshiyongyuanzeid,wcfFC));
                wsheet.addCell(new Label(8, mmKaishihang,mmyijian,wcfFC));
                mmKaishihang = mmKaishihang+1;


            }
            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void baofeiqianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                 @RequestParam("userid") String ppuserid,
                                 HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList=ddYltpbaofeiService.findBiaojuelist(ppxiangmuid,ppuserid);
        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,500); //第一行高度
            wsheet.setRowView(1,500); //第一行高度
            wsheet.mergeCells(0, 0, 8, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,6); //宽度
            wsheet.setColumnView(1,22); //宽度
            wsheet.setColumnView(2,26); //宽度
            wsheet.setColumnView(3,15); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,6); //宽度
            wsheet.setColumnView(6,30); //宽度
            wsheet.setColumnView(7,12); //宽度
            wsheet.setColumnView(8,10); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 2, 1);

            wsheet.addCell(new Label(3, 1, "签名："+mmusername,wcfFC2));
            wsheet.mergeCells(3, 1, 6, 1);

            wsheet.addCell(new Label(7, 1, "单位：万元",wcfFC2));
            wsheet.mergeCells(7, 1, 8, 1);

            wsheet.addCell(new Label(0, 2, "序号",wcfFC));
            wsheet.addCell(new Label(1, 2, "使用科室",wcfFC));
            wsheet.addCell(new Label(2, 2, "设备名称",wcfFC));
            wsheet.addCell(new Label(3, 2, "规格型号",wcfFC));
            wsheet.addCell(new Label(4, 2, "设备价值",wcfFC));
            wsheet.addCell(new Label(5, 2, "数量",wcfFC));
            wsheet.addCell(new Label(6, 2, "生产厂商",wcfFC));
            wsheet.addCell(new Label(7, 2, "采购时间",wcfFC));
            wsheet.addCell(new Label(8, 2, "表决建议",wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int mmKaishihang=3;

            for(int i=0;i<mmList.size();i++){
                Map<String,Object> mmMap=mmList.get(i);
                String mmXuhao = String.valueOf(i + 1);
                String mmshiyongkeshi=mmMap.get("shiyongkeshi")==null ? "" :mmMap.get("shiyongkeshi").toString();
                String mmshebeimingcheng=mmMap.get("shebeimingcheng")==null ? "" :mmMap.get("shebeimingcheng").toString();
                String mmguigexinghao=mmMap.get("guigexinghao")==null ? "" :mmMap.get("guigexinghao").toString();
                String mmshebeijiazhi=mmMap.get("sbjz")==null ? "" :mmMap.get("sbjz").toString();
                String mmshuliang=mmMap.get("shuliang")==null ? "" :mmMap.get("shuliang").toString();
                String mmshengchanchangshang=mmMap.get("shengchanchangshang")==null ? "" :mmMap.get("shengchanchangshang").toString();
                String mmlaiyuan=mmMap.get("laiyuan")==null ? "" :mmMap.get("laiyuan").toString();
                String mmcaigoushijian=mmMap.get("cgsj")==null ? "" :mmMap.get("cgsj").toString();
                String mmresult=mmMap.get("result")==null ? "" :mmMap.get("result").toString();
                String mmbiaojueren=mmMap.get("username")==null ? "" :mmMap.get("username").toString();
                String mmyijian="";
                if("1".equals(mmresult)){
                    mmyijian="同意";
                }else if("0".equals(mmresult)){
                    mmyijian="不同意";
                }else {
                    mmyijian="未表决";
                }

                wsheet.addCell(new Label(0, mmKaishihang,mmXuhao,wcfFC));
                wsheet.addCell(new Label(1, mmKaishihang, mmshiyongkeshi,wcfFC));
                wsheet.addCell(new Label(2, mmKaishihang,mmshebeimingcheng,wcfFC));
                wsheet.addCell(new Label(3, mmKaishihang,mmguigexinghao,wcfFC));
                wsheet.addCell(new Label(4, mmKaishihang,mmshebeijiazhi,wcfFC));
                wsheet.addCell(new Label(5, mmKaishihang,mmshuliang,wcfFC));
                wsheet.addCell(new Label(6, mmKaishihang,mmshengchanchangshang,wcfFC));
                wsheet.addCell(new Label(7, mmKaishihang,mmcaigoushijian,wcfFC));
                wsheet.addCell(new Label(8, mmKaishihang,mmyijian,wcfFC));
                mmKaishihang = mmKaishihang+1;


            }
            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void dailiangqianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                 @RequestParam("userid") String ppuserid,
                                 HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList=ddDailiangchuangxinService.findBiaojuelist(ppxiangmuid,ppuserid);
        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = "《东部战区总医院医用耗材供应目录》投票表决表（" + mmxiangmuname + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,500); //第一行高度
            wsheet.setRowView(1,500); //第一行高度
            wsheet.setRowView(2,500); //第一行高度
            wsheet.mergeCells(0, 0, 11, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,14); //宽度
            wsheet.setColumnView(1,5); //宽度
            wsheet.setColumnView(2,13); //宽度
            wsheet.setColumnView(3,13); //宽度
            wsheet.setColumnView(4,12); //宽度
            wsheet.setColumnView(5,11); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,9); //宽度
            wsheet.setColumnView(9,9); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,10); //宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(5, 1, "委 员（签字确认）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(5, 1, 11, 1);

            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 4, 1);

            wsheet.addCell(new Label(0, 2, "带量批次",wcfFC));
            wsheet.addCell(new Label(1, 2, "序号",wcfFC));
            wsheet.addCell(new Label(2, 2, "产品分类",wcfFC));
            wsheet.addCell(new Label(3, 2, "中标编码",wcfFC));
            wsheet.addCell(new Label(4, 2, "产品名称",wcfFC));
            wsheet.addCell(new Label(5, 2, "产品规格",wcfFC));
            wsheet.addCell(new Label(6, 2, "产品型号",wcfFC));
            wsheet.addCell(new Label(7, 2, "注册证号",wcfFC));
            wsheet.addCell(new Label(8, 2, "生产厂家",wcfFC));
            wsheet.addCell(new Label(9, 2, "单位",wcfFC));
            wsheet.addCell(new Label(10, 2, "单价/元",wcfFC));
            wsheet.addCell(new Label(11, 2, "表决意见",wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int mmKaishihang=3;

            for(int i=0;i<mmList.size();i++){
                Map<String,Object> mmMap=mmList.get(i);
                String mmdailiangpici=mmMap.get("dailiangpici")==null ? "" :mmMap.get("dailiangpici").toString();
                String mmXuhao=mmMap.get("ordernumber")==null ? "" :mmMap.get("ordernumber").toString();
                String mmchanpinfenlei=mmMap.get("chanpinfenlei")==null ? "" :mmMap.get("chanpinfenlei").toString();
                String mmzhongbiaobianma=mmMap.get("zhongbiaobianma")==null ? "" :mmMap.get("zhongbiaobianma").toString();
                String mmchanpinmingcheng=mmMap.get("chanpinmingcheng")==null ? "" :mmMap.get("chanpinmingcheng").toString();
                String mmchanpinguige=mmMap.get("chanpinguige")==null ? "" :mmMap.get("chanpinguige").toString();
                String mmchanpinxinghao=mmMap.get("chanpinxinghao")==null ? "" :mmMap.get("chanpinxinghao").toString();
                String mmzhucezhenghao=mmMap.get("zhecezhenghao")==null ? "" :mmMap.get("zhecezhenghao").toString();
                String mmshengchanchangjia=mmMap.get("shengchanchangjia")==null ? "" :mmMap.get("shengchanchangjia").toString();
                String mmdanwei=mmMap.get("danwei")==null ? "" :mmMap.get("danwei").toString();
                String mmdanjia=mmMap.get("danjia")==null ? "" :mmMap.get("danjia").toString();
                String mmresult=mmMap.get("result")==null ? "" :mmMap.get("result").toString();
                String mmyijian;
                if("1".equals(mmresult)){
                    mmyijian="同意";
                }else if("0".equals(mmresult)){
                    mmyijian="不同意";
                }else {
                    mmyijian="不同意";
                }

                wsheet.setRowView(mmKaishihang, 960);
                wsheet.addCell(new Label(0, mmKaishihang,mmdailiangpici,wcfFC));
                wsheet.addCell(new Label(1, mmKaishihang, mmXuhao,wcfFC));
                wsheet.addCell(new Label(2, mmKaishihang,mmchanpinfenlei,wcfFC));
                wsheet.addCell(new Label(3, mmKaishihang,mmzhongbiaobianma,wcfFC));
                wsheet.addCell(new Label(4, mmKaishihang,mmchanpinmingcheng,wcfFC));
                wsheet.addCell(new Label(5, mmKaishihang,mmchanpinguige,wcfFC));
                wsheet.addCell(new Label(6, mmKaishihang,mmchanpinxinghao,wcfFC));
                wsheet.addCell(new Label(7, mmKaishihang,mmzhucezhenghao,wcfFC));
                wsheet.addCell(new Label(8, mmKaishihang,mmshengchanchangjia,wcfFC));
                wsheet.addCell(new Label(9, mmKaishihang,mmdanwei,wcfFC));
                wsheet.addCell(new Label(10, mmKaishihang,mmdanjia,wcfFC));
                wsheet.addCell(new Label(11, mmKaishihang,mmyijian,wcfFC));
                mmKaishihang = mmKaishihang+1;


            }
            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    //设备汇总表
    public void shebeihuizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                  HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();
        List<Shebei> mmList=ddShebeiService.findlist(ppxiangmuid);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 12, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 12, 1);

            wsheet.addCell(new Label(0, 2, "院区",wcfFC));
            wsheet.addCell(new Label(1, 2, "序号",wcfFC));
            wsheet.addCell(new Label(2, 2, "使用科室",wcfFC));
            wsheet.addCell(new Label(3, 2, "设备名称",wcfFC));
            wsheet.addCell(new Label(4, 2, "型号",wcfFC));
            wsheet.addCell(new Label(5, 2, "台件数",wcfFC));
            wsheet.addCell(new Label(6, 2, "生产厂家",wcfFC));
            wsheet.addCell(new Label(7, 2, "序列号",wcfFC));
            wsheet.addCell(new Label(8, 2, "启用时间",wcfFC));
            wsheet.addCell(new Label(9, 2, "设备投放公司",wcfFC));
           /* wsheet.addCell(new Label(10, 2, "现产权归属",wcfFC));*/
            wsheet.addCell(new Label(10, 2, "问题类别",wcfFC));
         /*   wsheet.addCell(new Label(12, 2, "理由",wcfFC));*/
            wsheet.addCell(new Label(11, 2, "投票结果",wcfFC));
            wsheet.addCell(new Label(12, 2, "表决结果",wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int mmKaishihang=3;

            for(int i=0;i<mmList.size();i++){
                Shebei  mmlist=mmList.get(i);
                String mmXuhao = String.valueOf(i + 1);
                String mmYuanqu=mmlist.getYuanqu()==null ? "" :mmlist.getYuanqu();
                String mmshiyongkeshi=mmlist.getShiyongkeshi()==null ? "" :mmlist.getShiyongkeshi();
                String mmshebeimingcheng=mmlist.getShebeimingcheng()==null ? "" :mmlist.getShebeimingcheng();
                String mmXinghao=mmlist.getXinghao()==null ? "" :mmlist.getXinghao();
                String mmTaijianshu=mmlist.getTaijianshu()==null ? "" :mmlist.getTaijianshu();
                String mmShengchanchangshang=mmlist.getShengchanchangshang()==null ? "" :mmlist.getShengchanchangshang();
                String mmXuliehao=mmlist.getXuliehao()==null ? "" :mmlist.getXuliehao();
                String mmQiyongshijian=mmlist.getQiyongshijian()==null ? "" :mmlist.getQiyongshijian();
                String mmShebeigongsi=mmlist.getShebeigongsi()==null ? "" :mmlist.getShebeigongsi();
                String mmGuishu=mmlist.getGuishu()==null ? "" :mmlist.getGuishu();
                String mmLeibie=mmlist.getLeibie()==null ? "" :mmlist.getLeibie();
                String mmLiyou=mmlist.getLiyou()==null ? "" :mmlist.getLiyou();
                String mmdetailId=mmlist.getId()==null ? "" :mmlist.getId();
                int mmtoupiaoshu=ddService.getCountBydetailIdandResult(mmdetailId,"1");
                int mmzongshu=mmUserList.size();

                String mmpiaoshu="投票数"+mmtoupiaoshu+"/总数"+mmzongshu;

                String mmjieguo="";

                if(mmtoupiaoshu > mmPassNumber){
                    mmjieguo="通过";
                }else {
                    mmjieguo="不通过";
                }

                wsheet.setRowView(mmKaishihang, 760); //行高度
                wsheet.addCell(new Label(0, mmKaishihang,mmYuanqu,wcfFC));
                wsheet.addCell(new Label(1, mmKaishihang,mmXuhao,wcfFC));
                wsheet.addCell(new Label(2, mmKaishihang,mmshiyongkeshi,wcfFC));
                wsheet.addCell(new Label(3, mmKaishihang,mmshebeimingcheng,wcfFC));
                wsheet.addCell(new Label(4, mmKaishihang,mmXinghao,wcfFC));
                wsheet.addCell(new Label(5, mmKaishihang,mmTaijianshu,wcfFC));
                wsheet.addCell(new Label(6, mmKaishihang,mmShengchanchangshang,wcfFC));
                wsheet.addCell(new Label(7, mmKaishihang,mmXuliehao,wcfFC));
                wsheet.addCell(new Label(8, mmKaishihang,mmQiyongshijian,wcfFC));
                wsheet.addCell(new Label(9, mmKaishihang,mmShebeigongsi,wcfFC));
             /*   wsheet.addCell(new Label(10, mmKaishihang,mmGuishu,wcfFC));*/
                wsheet.addCell(new Label(10, mmKaishihang,mmLeibie,wcfFC));
             /*   wsheet.addCell(new Label(12, mmKaishihang,mmLiyou,wcfFC));*/
                wsheet.addCell(new Label(11, mmKaishihang,mmpiaoshu,wcfFC));
                wsheet.addCell(new Label(12, mmKaishihang,mmjieguo,wcfFC));
                mmKaishihang = mmKaishihang+1;
            }
            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc1huizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                               HttpServletRequest request, HttpServletResponse response){
        long stime = System.currentTimeMillis();
        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc3Example mmExample=new Hc3Example();
        mmExample.setOrderByClause("ordernum");
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc3> mmList=hc3Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        YltpJieguoExample yltpJieguoExample=new YltpJieguoExample();
        yltpJieguoExample.createCriteria().andResultEqualTo("1");
        List<YltpJieguo> jieguolist=yltpJieguoMapper.selectByExample(yltpJieguoExample);

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 13, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,14); //宽度
            wsheet.setColumnView(13,14); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 13, 1);

            wsheet.addCell(new Label(0, 2, "引进类型",wcfFC));
            wsheet.addCell(new Label(1, 2, "序号",wcfFC));
            wsheet.addCell(new Label(2, 2, "带量备注", wcfFC));
            wsheet.addCell(new Label(3, 2, "产品类别", wcfFC));
            wsheet.addCell(new Label(4, 2, "中标编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "注册证名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "生产商", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "价格", wcfFC));

            wsheet.addCell(new Label(12, 2, "投票结果",wcfFC));
            wsheet.addCell(new Label(13, 2, "表决结果",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            int mmKaishihang=3;
            int mmpinpaiKaishihang=mmKaishihang;
            int mmpinguiKaishihang=mmKaishihang;

            List<Hc3> pinpailist = mmList.stream()
                    .filter(distinctByKey(Hc3::getXuhao))
                    .collect(Collectors.toList());

            for (int j = 0; j < pinpailist.size(); j++) {
                int s=0;
                int mmPinpaiHebingshu = 0;
                Hc3 mmPinpaiOne = pinpailist.get(j);
                if (mmPinpaiOne!=null){
                    List<Hc3> pinguilist = mmList.stream().filter(x -> x.getXuhao().equals(mmPinpaiOne.getXuhao())).collect(Collectors.toList());
                    if (pinguilist.size()>0){
                        mmPinpaiHebingshu = pinguilist.size()-1;
                    }
                    for (int k = 0; k < pinguilist.size(); k++) {
                        Hc3 pinguiOne = pinguilist.get(k);
                        if (pinguiOne != null) {
                            String mmdetailId = pinguiOne.getId();
                            String yinjinleixing = pinguiOne.getBeizhu1() == null ? "" : pinguiOne.getBeizhu1();
                            String zongxuhao=pinguiOne.getXuhao()==null ? "" :pinguiOne.getXuhao().toString();
                            String dailiangbeuzhu=pinguiOne.getBeizhu2()==null ? "" :pinguiOne.getBeizhu2().toString();
                            String chanpinleibie = pinguiOne.getBeizhu3() == null ? "" : pinguiOne.getBeizhu3();
                            String zhongbiaobianma = pinguiOne.getZhongbiaobianma() == null ? "" : pinguiOne.getZhongbiaobianma();
                            String zhucezhengmingcheng = pinguiOne.getBeizhu4() == null ? "" : pinguiOne.getBeizhu4();
                            String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                            String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                            String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                            String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                            String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                            String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                            long mmtoupiaoshu=jieguolist.stream().filter(x -> x.getDetailid().equals(mmdetailId)).collect(Collectors.counting());
                            String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                            String mmjieguo="";

                            WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                            if(mmtoupiaoshu > mmPassNumber){
                                mmjieguo="通过";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                mmjieguo="不通过";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }

                            wsheet.setRowView(mmpinguiKaishihang, 500);
                            wsheet.addCell(new Label(0, mmpinguiKaishihang,yinjinleixing,wcfFC));
                            wsheet.addCell(new Label(1, mmpinguiKaishihang,zongxuhao,wcfFC));
                            wsheet.addCell(new Label(2, mmpinguiKaishihang,dailiangbeuzhu,wcfFC));
                            wsheet.addCell(new Label(3, mmpinguiKaishihang,chanpinleibie,wcfFC));
                            wsheet.addCell(new Label(4, mmpinguiKaishihang,zhongbiaobianma,wcfFC));
                            wsheet.addCell(new Label(5, mmpinguiKaishihang,zhucezhengmingcheng,wcfFC));
                            wsheet.addCell(new Label(6, mmpinguiKaishihang,guige,wcfFC));
                            wsheet.addCell(new Label(7, mmpinguiKaishihang,xinghao,wcfFC));
                            wsheet.addCell(new Label(8, mmpinguiKaishihang,zhucezheng,wcfFC));
                            wsheet.addCell(new Label(9, mmpinguiKaishihang,shengchanchangjia,wcfFC));
                            wsheet.addCell(new Label(10, mmpinguiKaishihang,danwei,wcfFC));
                            wsheet.addCell(new Label(11, mmpinguiKaishihang,danjia,wcfFC));

                            wsheet.addCell(new Label(12, mmpinguiKaishihang,mmpiaoshu,wcfFC));
                            wsheet.addCell(new Label(13, mmpinguiKaishihang,mmjieguo,jieguocolor));

                            mmpinguiKaishihang = mmpinguiKaishihang+1;
                        }
                    }

                    mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                }

            }
            long etime = System.currentTimeMillis();
            System.out.printf("执行时长：%d 毫秒.", (etime - stime));
            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc6huizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                               HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc3Example mmExample=new Hc3Example();
        mmExample.setOrderByClause("ordernum");
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc3> mmList=hc3Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 8, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,12); //宽度
            wsheet.setColumnView(3,12); //宽度
            wsheet.setColumnView(4,12); //宽度
            wsheet.setColumnView(5,14); //宽度
            wsheet.setColumnView(6,14); //宽度
            wsheet.setColumnView(7,14); //宽度
            wsheet.setColumnView(8,12); //宽度




            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 8, 1);

            wsheet.addCell(new Label(0, 2, "序号",wcfFC));
            wsheet.addCell(new Label(1, 2, "中标编码",wcfFC));
            wsheet.addCell(new Label(2, 2, "注册证名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "型号", wcfFC));
            wsheet.addCell(new Label(5, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产商", wcfFC));


            wsheet.addCell(new Label(7, 2, "投票结果",wcfFC));
            wsheet.addCell(new Label(8, 2, "表决结果",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            int mmKaishihang=3;
            int mmpinpaiKaishihang=mmKaishihang;
            int mmpinguiKaishihang=mmKaishihang;

            List<Hc3> pinpailist = mmList.stream()
                    .filter(distinctByKey(Hc3::getXuhao))
                    .collect(Collectors.toList());

            for (int j = 0; j < pinpailist.size(); j++) {
                int s=0;
                int mmPinpaiHebingshu = 0;
                Hc3 mmPinpaiOne = pinpailist.get(j);
                if (mmPinpaiOne!=null){
                    List<Hc3> pinguilist = mmList.stream().filter(x -> x.getXuhao().equals(mmPinpaiOne.getXuhao())).collect(Collectors.toList());
                    if (pinguilist.size()>0){
                        mmPinpaiHebingshu = pinguilist.size()-1;
                    }
                    for (int k = 0; k < pinguilist.size(); k++) {
                        Hc3 pinguiOne = pinguilist.get(k);
                        if (pinguiOne != null) {
                            String mmdetailId = pinguiOne.getId();

                            String zongxuhao=pinguiOne.getXuhao()==null ? "" :pinguiOne.getXuhao().toString();
                            String zhongbiaobianma = pinguiOne.getZhongbiaobianma() == null ? "" : pinguiOne.getZhongbiaobianma();
                            String zhucezhengmingcheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                            String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                            String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                            String zhucezheng = pinguiOne.getBeizhu1() == null ? "" : pinguiOne.getBeizhu1();
                            String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                            int mmtoupiaoshu=ddService.getCountBydetailIdandResult(mmdetailId,"1");
                            String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                            String mmjieguo="";

                            WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                            if(mmtoupiaoshu > mmPassNumber){
                                mmjieguo="通过";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                mmjieguo="不通过";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }

                            wsheet.setRowView(mmpinguiKaishihang, 500);
                            wsheet.addCell(new Label(0, mmpinguiKaishihang,zongxuhao,wcfFC));
                            wsheet.addCell(new Label(1, mmpinguiKaishihang,zhongbiaobianma,wcfFC));
                            wsheet.addCell(new Label(2, mmpinguiKaishihang,zhucezhengmingcheng,wcfFC));
                            wsheet.addCell(new Label(3, mmpinguiKaishihang,guige,wcfFC));
                            wsheet.addCell(new Label(4, mmpinguiKaishihang,xinghao,wcfFC));
                            wsheet.addCell(new Label(5, mmpinguiKaishihang,zhucezheng,wcfFC));
                            wsheet.addCell(new Label(6, mmpinguiKaishihang,shengchanchangjia,wcfFC));

                            wsheet.addCell(new Label(7, mmpinguiKaishihang,mmpiaoshu,wcfFC));
                            wsheet.addCell(new Label(8, mmpinguiKaishihang,mmjieguo,jieguocolor));

                            mmpinguiKaishihang = mmpinguiKaishihang+1;
                        }
                    }

                    mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                }

            }

            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc2huizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                  HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc2Example mmExample=new Hc2Example();
        mmExample.setOrderByClause("ordernum");
        Hc2Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc2> mmList=hc2Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 17, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,10); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,10); //宽度
            wsheet.setColumnView(16,14); //宽度
            wsheet.setColumnView(17,14); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 17, 1);

            wsheet.addCell(new Label(0, 2, "引进类型",wcfFC));
            wsheet.mergeCells(0,2,0,3);
            wsheet.addCell(new Label(1, 2, "总序号",wcfFC));
            wsheet.mergeCells(1,2,1,3);
            wsheet.addCell(new Label(2, 2, "设备信息",wcfFC));
            wsheet.mergeCells(2,2,5,2);
            wsheet.addCell(new Label(2, 3, "设备名称",wcfFC));
            wsheet.addCell(new Label(3, 3, "设备型号",wcfFC));
            wsheet.addCell(new Label(4, 3, "设备来源",wcfFC));
            wsheet.addCell(new Label(5, 3, "设备品牌",wcfFC));

            wsheet.addCell(new Label(6, 2, "配套耗材（试剂）信息",wcfFC));
            wsheet.mergeCells(6,2,14,2);
            wsheet.addCell(new Label(6, 3, "平台编码",wcfFC));
            wsheet.addCell(new Label(7, 3, "产品名称",wcfFC));
            wsheet.addCell(new Label(8, 3, "规格",wcfFC));
            wsheet.addCell(new Label(9, 3, "型号",wcfFC));
            wsheet.addCell(new Label(10, 3, "注册证号",wcfFC));
            wsheet.addCell(new Label(11, 3, "生产厂家",wcfFC));
            wsheet.addCell(new Label(12, 3, "单位",wcfFC));
            wsheet.addCell(new Label(13, 3, "单价",wcfFC));
            wsheet.addCell(new Label(14, 3, "医保编码",wcfFC));


            wsheet.addCell(new Label(15, 2, "国产/进口",wcfFC));
            wsheet.mergeCells(15,2,15,3);


            wsheet.addCell(new Label(16, 2, "投票结果",wcfFC));
            wsheet.mergeCells(16,2,16,3);
            wsheet.addCell(new Label(17, 2, "表决结果",wcfFC));
            wsheet.mergeCells(17,2,17,3);


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            int mmKaishihang=4;
            int mmpinpaiKaishihang=mmKaishihang;
            int mmpinguiKaishihang=mmKaishihang;

            List<Hc2> pinpailist = mmList.stream()
                    .filter(distinctByKey(Hc2::getZongxuhao))
                    .collect(Collectors.toList());

            for (int j = 0; j < pinpailist.size(); j++) {
                int s=0;
                int mmPinpaiHebingshu = 0;
                Hc2 mmPinpaiOne = pinpailist.get(j);
                if (mmPinpaiOne!=null){
                    List<Hc2> pinguilist = mmList.stream().filter(x -> x.getZongxuhao().equals(mmPinpaiOne.getZongxuhao())).collect(Collectors.toList());
                    if (pinguilist.size()>0){
                        mmPinpaiHebingshu = pinguilist.size()-1;
                    }
                    for (int k = 0; k < pinguilist.size(); k++) {
                        Hc2 pinguiOne = pinguilist.get(k);
                        if (pinguiOne != null) {
                            String mmdetailId = pinguiOne.getId();
                            String yinjinleixing = pinguiOne.getYinjinleixing() == null ? "" : pinguiOne.getYinjinleixing();
                            Integer zongxuhao = pinguiOne.getZongxuhao();
                            String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                            String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                            String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                            String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                            String zhucezhenghao = pinguiOne.getZhucezhenghao() == null ? "" : pinguiOne.getZhucezhenghao();
                            String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                            String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                            String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                            String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                            int mmtoupiaoshu=ddService.getCountBydetailIdandResult(mmdetailId,"1");
                            String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                            String mmjieguo="";

                            WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                            if(mmtoupiaoshu > mmPassNumber){
                                mmjieguo="通过";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                mmjieguo="不通过";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }


                            wsheet.setRowView(mmpinguiKaishihang, 500); // 设置第3行的行高为500
                            wsheet.addCell(new Label(0, mmpinguiKaishihang,yinjinleixing,wcfFC));
                            wsheet.addCell(new Label(1, mmpinguiKaishihang,zongxuhao.toString(),wcfFC));
                            wsheet.addCell(new Label(6, mmpinguiKaishihang, pingtaibianma, wcfFC));
                            wsheet.addCell(new Label(7, mmpinguiKaishihang, chanpinmingcheng, wcfFC));
                            wsheet.addCell(new Label(8, mmpinguiKaishihang, guige, wcfFC));
                            wsheet.addCell(new Label(9, mmpinguiKaishihang, xinghao, wcfFC));
                            wsheet.addCell(new Label(10, mmpinguiKaishihang, zhucezhenghao, wcfFC));
                            wsheet.addCell(new Label(11, mmpinguiKaishihang, shengchanchangjia, wcfFC));
                            wsheet.addCell(new Label(12, mmpinguiKaishihang, danwei, wcfFC));
                            wsheet.addCell(new Label(13, mmpinguiKaishihang, danjia, wcfFC));
                            wsheet.addCell(new Label(14, mmpinguiKaishihang, yibaobianma, wcfFC));

                            wsheet.addCell(new Label(16, mmpinguiKaishihang,mmpiaoshu,wcfFC));
                            wsheet.addCell(new Label(17, mmpinguiKaishihang,mmjieguo,jieguocolor));

                            mmpinguiKaishihang = mmpinguiKaishihang+1;
                        }
                    }

                    String shebeimingcheng = mmPinpaiOne.getShebeimingcheng() == null ? "" : mmPinpaiOne.getShebeimingcheng();
                    String shebeixinghao = mmPinpaiOne.getShebeixinghao() == null ? "" : mmPinpaiOne.getShebeixinghao();
                    String shebeilaiyuan = mmPinpaiOne.getShebeilaiyuan() == null ? "" : mmPinpaiOne.getShebeilaiyuan();
                    String shebeipinpai = mmPinpaiOne.getBeizhu1() == null ? "" : mmPinpaiOne.getBeizhu1();
                    String shebeixuliehao = mmPinpaiOne.getShebeixuliehao() == null ? "" : mmPinpaiOne.getShebeixuliehao();
                    String shebeishengchanchangjia = mmPinpaiOne.getShebeishengchanchangjia() == null ? "" : mmPinpaiOne.getShebeishengchanchangjia();
                    String guochanjinkou = mmPinpaiOne.getGuochanjinkou() == null ? "" : mmPinpaiOne.getGuochanjinkou();

                    wsheet.addCell(new Label(2, mmpinpaiKaishihang, shebeimingcheng, wcfFC));
                    wsheet.addCell(new Label(3, mmpinpaiKaishihang, shebeixinghao, wcfFC));
                    wsheet.addCell(new Label(4, mmpinpaiKaishihang, shebeilaiyuan, wcfFC));
                    wsheet.addCell(new Label(5, mmpinpaiKaishihang, shebeipinpai, wcfFC));
                    wsheet.addCell(new Label(15, mmpinpaiKaishihang, guochanjinkou, wcfFC));
                    wsheet.mergeCells(2, mmpinpaiKaishihang, 2, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(4, mmpinpaiKaishihang, 4, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(5, mmpinpaiKaishihang, 5, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(15, mmpinpaiKaishihang, 15, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                }

            }

            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc3huizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                  HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc2Example mmExample=new Hc2Example();
        mmExample.setOrderByClause("ordernum");
        Hc2Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc2> mmList=hc2Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 19, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,10); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,10); //宽度
            wsheet.setColumnView(16,12); //宽度
            wsheet.setColumnView(17,10); //宽度
            wsheet.setColumnView(18,14); //宽度
            wsheet.setColumnView(19,14); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 19, 1);

            wsheet.addCell(new Label(0, 2, "引进类型",wcfFC));
            wsheet.mergeCells(0,2,0,3);
            wsheet.addCell(new Label(1, 2, "总序号",wcfFC));
            wsheet.mergeCells(1,2,1,3);
            wsheet.addCell(new Label(2, 2, "设备信息",wcfFC));
            wsheet.mergeCells(2,2,7,2);
            wsheet.addCell(new Label(2, 3, "设备名称",wcfFC));
            wsheet.addCell(new Label(3, 3, "设备型号",wcfFC));
            wsheet.addCell(new Label(4, 3, "设备来源",wcfFC));
            wsheet.addCell(new Label(5, 3, "启用日期",wcfFC));
            wsheet.addCell(new Label(6, 3, "设备序列号",wcfFC));
            wsheet.addCell(new Label(7, 3, "设备生产厂家",wcfFC));

            wsheet.addCell(new Label(8, 2, "配套耗材（试剂）信息",wcfFC));
            wsheet.mergeCells(8,2,16,2);
            wsheet.addCell(new Label(8, 3, "平台编码",wcfFC));
            wsheet.addCell(new Label(9, 3, "产品名称",wcfFC));
            wsheet.addCell(new Label(10, 3, "规格",wcfFC));
            wsheet.addCell(new Label(11, 3, "型号",wcfFC));
            wsheet.addCell(new Label(12, 3, "注册证号",wcfFC));
            wsheet.addCell(new Label(13, 3, "生产厂家",wcfFC));
            wsheet.addCell(new Label(14, 3, "单位",wcfFC));
            wsheet.addCell(new Label(15, 3, "单价",wcfFC));
            wsheet.addCell(new Label(16, 3, "医保编码",wcfFC));


            wsheet.addCell(new Label(17, 2, "国产/进口",wcfFC));
            wsheet.mergeCells(17,2,17,3);


            wsheet.addCell(new Label(18, 2, "投票结果",wcfFC));
            wsheet.mergeCells(18,2,18,3);
            wsheet.addCell(new Label(19, 2, "表决结果",wcfFC));
            wsheet.mergeCells(19,2,19,3);


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);
            int mmKaishihang=4;
            int mmpinpaiKaishihang=mmKaishihang;
            int mmpinguiKaishihang=mmKaishihang;

            List<Hc2> pinpailist = mmList.stream()
                    .filter(distinctByKey(Hc2::getZongxuhao))
                    .collect(Collectors.toList());

            for (int j = 0; j < pinpailist.size(); j++) {
                int s=0;
                int mmPinpaiHebingshu = 0;
                Hc2 mmPinpaiOne = pinpailist.get(j);
                if (mmPinpaiOne!=null){
                    List<Hc2> pinguilist = mmList.stream().filter(x -> x.getZongxuhao().equals(mmPinpaiOne.getZongxuhao())).collect(Collectors.toList());
                    if (pinguilist.size()>0){
                        mmPinpaiHebingshu = pinguilist.size()-1;
                    }
                    for (int k = 0; k < pinguilist.size(); k++) {
                        Hc2 pinguiOne = pinguilist.get(k);
                        if (pinguiOne != null) {
                            String mmdetailId = pinguiOne.getId();
                            String yinjinleixing = pinguiOne.getYinjinleixing() == null ? "" : pinguiOne.getYinjinleixing();
                            Integer zongxuhao = pinguiOne.getZongxuhao();
                            String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                            String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                            String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                            String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                            String zhucezhenghao = pinguiOne.getZhucezhenghao() == null ? "" : pinguiOne.getZhucezhenghao();
                            String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                            String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                            String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                            String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                            int mmtoupiaoshu=ddService.getCountBydetailIdandResult(mmdetailId,"1");
                            String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                            String mmjieguo="";

                            WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                            if(mmtoupiaoshu > mmPassNumber){
                                mmjieguo="通过";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                mmjieguo="不通过";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }


                            wsheet.setRowView(mmpinguiKaishihang, 500); // 设置第3行的行高为500
                            wsheet.addCell(new Label(0, mmpinguiKaishihang,yinjinleixing,wcfFC));
                            wsheet.addCell(new Label(1, mmpinguiKaishihang,zongxuhao.toString(),wcfFC));
                            wsheet.addCell(new Label(8, mmpinguiKaishihang, pingtaibianma, wcfFC));
                            wsheet.addCell(new Label(9, mmpinguiKaishihang, chanpinmingcheng, wcfFC));
                            wsheet.addCell(new Label(10, mmpinguiKaishihang, guige, wcfFC));
                            wsheet.addCell(new Label(11, mmpinguiKaishihang, xinghao, wcfFC));
                            wsheet.addCell(new Label(12, mmpinguiKaishihang, zhucezhenghao, wcfFC));
                            wsheet.addCell(new Label(13, mmpinguiKaishihang, shengchanchangjia, wcfFC));
                            wsheet.addCell(new Label(14, mmpinguiKaishihang, danwei, wcfFC));
                            wsheet.addCell(new Label(15, mmpinguiKaishihang, danjia, wcfFC));
                            wsheet.addCell(new Label(16, mmpinguiKaishihang, yibaobianma, wcfFC));

                            wsheet.addCell(new Label(18, mmpinguiKaishihang,mmpiaoshu,wcfFC));
                            wsheet.addCell(new Label(19, mmpinguiKaishihang,mmjieguo,jieguocolor));

                            mmpinguiKaishihang = mmpinguiKaishihang+1;
                        }
                    }

                    String shebeimingcheng = mmPinpaiOne.getShebeimingcheng() == null ? "" : mmPinpaiOne.getShebeimingcheng();
                    String shebeixinghao = mmPinpaiOne.getShebeixinghao() == null ? "" : mmPinpaiOne.getShebeixinghao();
                    String shebeilaiyuan = mmPinpaiOne.getShebeilaiyuan() == null ? "" : mmPinpaiOne.getShebeilaiyuan();
                    String qiyongriqi = mmPinpaiOne.getQiyongriqi() == null ? "" : mmPinpaiOne.getQiyongriqi();
                    String shebeixuliehao = mmPinpaiOne.getShebeixuliehao() == null ? "" : mmPinpaiOne.getShebeixuliehao();
                    String shebeishengchanchangjia = mmPinpaiOne.getShebeishengchanchangjia() == null ? "" : mmPinpaiOne.getShebeishengchanchangjia();
                    String guochanjinkou = mmPinpaiOne.getGuochanjinkou() == null ? "" : mmPinpaiOne.getGuochanjinkou();

                    wsheet.addCell(new Label(2, mmpinpaiKaishihang, shebeimingcheng, wcfFC));
                    wsheet.addCell(new Label(3, mmpinpaiKaishihang, shebeixinghao, wcfFC));
                    wsheet.addCell(new Label(4, mmpinpaiKaishihang, shebeilaiyuan, wcfFC));
                    wsheet.addCell(new Label(5, mmpinpaiKaishihang, qiyongriqi, wcfFC));
                    wsheet.addCell(new Label(6, mmpinpaiKaishihang, shebeixuliehao, wcfFC));
                    wsheet.addCell(new Label(7, mmpinpaiKaishihang, shebeishengchanchangjia, wcfFC));
                    wsheet.addCell(new Label(17, mmpinpaiKaishihang, guochanjinkou, wcfFC));
                    wsheet.mergeCells(2, mmpinpaiKaishihang, 2, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(4, mmpinpaiKaishihang, 4, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(5, mmpinpaiKaishihang, 5, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(6, mmpinpaiKaishihang, 6, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(7, mmpinpaiKaishihang, 7, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(17, mmpinpaiKaishihang, 17, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                }

            }

            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc4huizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                               HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        HcjieguoExample hcjieguoExample=new HcjieguoExample();
        hcjieguoExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hcjieguo> jieguolist=  hcjieguoMapper.selectByExample(hcjieguoExample);

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 19, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,10);  //宽度
            wsheet.setColumnView(16,14); //宽度
            wsheet.setColumnView(17,14); //宽度
            wsheet.setColumnView(18,14); //宽度
            wsheet.setColumnView(19,14); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 19, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "申请科室", wcfFC));

            wsheet.addCell(new Label(16, 2, "品牌结果",wcfFC));
            wsheet.addCell(new Label(17, 2, "品牌票数",wcfFC));
            wsheet.addCell(new Label(18, 2, "品规结果",wcfFC));
            wsheet.addCell(new Label(19, 2, "品规票数",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();
                                String keshi = pinguiOne.getKeshi() == null ? "" : pinguiOne.getKeshi();

                                int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getDetailid().equals(mmdetailId)
                                                &&x.getResult().equals("1"))
                                        .collect(Collectors.toList()).size();

                                String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(mmtoupiaoshu > mmPassNumber){
                                    mmjieguo="通过";
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不通过";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }

                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));
                                wsheet.addCell(new Label(15, mmxinghaoKaishihang, keshi, wcfFC));


                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(19, mmxinghaoKaishihang, mmpiaoshu, wcfFC));
                                    wsheet.addCell(new Label(18, mmxinghaoKaishihang, mmjieguo, jieguocolor));
                                }else {
                                    wsheet.addCell(new Label(19, mmxinghaoKaishihang, "", wcfFC));
                                    wsheet.addCell(new Label(18, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                        String pinpaijieguo="";
                        int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getPinzhong().equals(pinzhongOne.getZongxuhao())
                                        &&x.getPinpai().equals(pinpaiOne.getPinpai())
                                        &&x.getResult().equals("1"))
                                .filter(distinctByKey(p -> p.getUserid()))
                                .collect(Collectors.toList()).size();

                        String mmpiaoshu=mmtoupiaoshu+"/"+personCount;
                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if(mmtoupiaoshu > mmPassNumber){
                                pinpaijieguo="通过";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                pinpaijieguo="不通过";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }
                        }else {
                            mmpiaoshu="";
                            pinpaijieguo = "";
                        }
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, pinpaijieguo,wcfFC));
                        wsheet.addCell(new Label(17, mmpinpaiKaishihang, mmpiaoshu,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(16, mmpinpaiKaishihang, 16, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(17, mmpinpaiKaishihang, 17, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }
                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                String beizhu = pinzhongOne.getBeizhu() == null ? "" : pinzhongOne.getBeizhu();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.addCell(new Label(14, mmpinzhongKaishihang, beizhu,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(14, mmpinzhongKaishihang, 14, mmpinzhongKaishihang+mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc5huizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                               HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        HcjieguoExample hcjieguoExample=new HcjieguoExample();
        hcjieguoExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hcjieguo> jieguolist=  hcjieguoMapper.selectByExample(hcjieguoExample);

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 19, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,10);  //宽度
            wsheet.setColumnView(16,14); //宽度
            wsheet.setColumnView(17,14); //宽度
            wsheet.setColumnView(18,14); //宽度
            wsheet.setColumnView(19,14); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 17, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "申请科室", wcfFC));


            wsheet.addCell(new Label(16, 2, "品牌结果",wcfFC));
            wsheet.addCell(new Label(17, 2, "品牌票数",wcfFC));
            wsheet.addCell(new Label(18, 2, "品规结果",wcfFC));
            wsheet.addCell(new Label(19, 2, "品规票数",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);


            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();
                                String shenqingkeshi = pinguiOne.getKeshi() == null ? "" : pinguiOne.getGuochanjinkou();


                                int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getDetailid().equals(mmdetailId)
                                                &&x.getResult().equals("1"))
                                        .collect(Collectors.toList()).size();

                                String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(mmtoupiaoshu > mmPassNumber){
                                    mmjieguo="通过";
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不通过";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }

                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));
                                wsheet.addCell(new Label(15, mmxinghaoKaishihang, shenqingkeshi, wcfFC));

                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(19, mmxinghaoKaishihang, mmpiaoshu, wcfFC));
                                    wsheet.addCell(new Label(18, mmxinghaoKaishihang, mmjieguo, jieguocolor));
                                }else {
                                    wsheet.addCell(new Label(19, mmxinghaoKaishihang, "", wcfFC));
                                    wsheet.addCell(new Label(18, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                        String pinpaijieguo="";
                        int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getPinzhong().equals(pinzhongOne.getZongxuhao())
                                        &&x.getPinpai().equals(pinpaiOne.getPinpai())
                                        &&x.getResult().equals("1"))
                                .filter(distinctByKey(p -> p.getUserid()))
                                .collect(Collectors.toList()).size();

                        String mmpiaoshu=mmtoupiaoshu+"/"+personCount;
                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if(mmtoupiaoshu > mmPassNumber){
                                pinpaijieguo="通过";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                pinpaijieguo="不通过";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }
                        }else {
                            mmpiaoshu="";
                            pinpaijieguo = "";
                        }
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, pinpaijieguo,wcfFC));
                        wsheet.addCell(new Label(17, mmpinpaiKaishihang, mmpiaoshu,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(16, mmpinpaiKaishihang, 16, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(17, mmpinpaiKaishihang, 17, mmpinpaiKaishihang+mmPinpaiHebingshu);

                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }
                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                String beizhu = pinzhongOne.getBeizhu() == null ? "" : pinzhongOne.getBeizhu();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.addCell(new Label(14, mmpinzhongKaishihang, beizhu,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(14, mmpinzhongKaishihang, 14, mmpinzhongKaishihang+mmHebingshu);

                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void Onehuizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                               HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        HcjieguoExample hcjieguoExample=new HcjieguoExample();
        hcjieguoExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hcjieguo> jieguolist=  hcjieguoMapper.selectByExample(hcjieguoExample);

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 17, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,14); //宽度
            wsheet.setColumnView(15,14);  //宽度
            wsheet.setColumnView(16,14); //宽度
            wsheet.setColumnView(17,14); //宽度





            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 17, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));


            wsheet.addCell(new Label(14, 2, "品牌表决",wcfFC));
            wsheet.addCell(new Label(15, 2, "品牌票数",wcfFC));
            wsheet.addCell(new Label(16, 2, "品规结果",wcfFC));
            wsheet.addCell(new Label(17, 2, "品规票数",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);


            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();



                                int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getDetailid().equals(mmdetailId)
                                                &&x.getResult().equals("1"))
                                        .collect(Collectors.toList()).size();

                                String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(mmtoupiaoshu > mmPassNumber){
                                    mmjieguo="通过";
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不通过";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }

                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));


                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(17, mmxinghaoKaishihang, mmpiaoshu, wcfFC));
                                    wsheet.addCell(new Label(16, mmxinghaoKaishihang, mmjieguo, jieguocolor));
                                }else {
                                    wsheet.addCell(new Label(17, mmxinghaoKaishihang, "", wcfFC));
                                    wsheet.addCell(new Label(16, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                        String pinpaijieguo="";
                        int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getPinzhong().equals(pinzhongOne.getZongxuhao())
                                        &&x.getPinpai().equals(pinpaiOne.getPinpai())
                                        &&x.getResult().equals("1"))
                                .filter(distinctByKey(p -> p.getUserid()))
                                .collect(Collectors.toList()).size();

                        String mmpiaoshu=mmtoupiaoshu+"/"+personCount;
                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if(mmtoupiaoshu > mmPassNumber){
                                pinpaijieguo="通过";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                pinpaijieguo="不通过";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }
                        }else {
                            mmpiaoshu="";
                            pinpaijieguo = "";
                        }
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, pinpaijieguo,jieguocolor));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, mmpiaoshu,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(14, mmpinpaiKaishihang, 14, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(15, mmpinpaiKaishihang, 15, mmpinpaiKaishihang+mmPinpaiHebingshu);

                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }


                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();

                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);


                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void OnePinzhonghuizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                               HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        HcjieguoExample hcjieguoExample=new HcjieguoExample();
        hcjieguoExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hcjieguo> jieguolist=  hcjieguoMapper.selectByExample(hcjieguoExample);

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 14 , 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,14); //宽度





            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 14, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "单位", wcfFC));
            wsheet.addCell(new Label(10, 2, "单价", wcfFC));
            wsheet.addCell(new Label(11, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(12, 2, "国产/进口", wcfFC));

            wsheet.addCell(new Label(13, 2, "品种表决",wcfFC));
            wsheet.addCell(new Label(14, 2, "品种票数",wcfFC));




            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);


            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();

                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();


                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, guochanjinkou, wcfFC));

                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }

                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));

                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);

                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }

                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                String pinzhongjieguo="";
                int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getPinzhong().equals(pinzhongOne.getZongxuhao())
                                &&x.getResult().equals("1"))
                        .filter(distinctByKey(p -> p.getUserid()))
                        .collect(Collectors.toList()).size();

                String mmpiaoshu=mmtoupiaoshu+"/"+personCount;
                if(mmtoupiaoshu > mmPassNumber){
                    pinzhongjieguo="通过";
                    jieguocolor = new WritableCellFormat(wcfFCt);
                }else {
                    pinzhongjieguo="不通过";
                    jieguocolor = new WritableCellFormat(wcfFCb);
                }

                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();

                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.addCell(new Label(13, mmpinzhongKaishihang, pinzhongjieguo,jieguocolor));
                wsheet.addCell(new Label(14, mmpinzhongKaishihang, mmpiaoshu,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(13, mmpinzhongKaishihang, 13, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(14, mmpinzhongKaishihang, 14, mmpinzhongKaishihang+mmHebingshu);

                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void TwoFourhuizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                               HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        HcjieguoExample hcjieguoExample=new HcjieguoExample();
        hcjieguoExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hcjieguo> jieguolist=  hcjieguoMapper.selectByExample(hcjieguoExample);

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 17, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,14); //宽度
            wsheet.setColumnView(15,14);  //宽度
            wsheet.setColumnView(16,14); //宽度
            wsheet.setColumnView(17,14); //宽度





            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 17, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));

            wsheet.addCell(new Label(14, 2, "品牌表决",wcfFC));
            wsheet.addCell(new Label(15, 2, "品牌票数",wcfFC));
            wsheet.addCell(new Label(16, 2, "品规结果",wcfFC));
            wsheet.addCell(new Label(17, 2, "品规票数",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);


            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();


                                int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getDetailid().equals(mmdetailId)
                                                &&x.getResult().equals("1"))
                                        .collect(Collectors.toList()).size();

                                String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(mmtoupiaoshu > mmPassNumber){
                                    mmjieguo="通过";
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不通过";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }

                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));


                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(17, mmxinghaoKaishihang, mmpiaoshu, wcfFC));
                                    wsheet.addCell(new Label(16, mmxinghaoKaishihang, mmjieguo, jieguocolor));
                                }else {
                                    wsheet.addCell(new Label(17, mmxinghaoKaishihang, "", wcfFC));
                                    wsheet.addCell(new Label(16, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                        String pinpaijieguo="";
                        int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getPinzhong().equals(pinzhongOne.getZongxuhao())
                                        &&x.getPinpai().equals(pinpaiOne.getPinpai())
                                        &&x.getResult().equals("1"))
                                .filter(distinctByKey(p -> p.getUserid()))
                                .collect(Collectors.toList()).size();

                        String mmpiaoshu=mmtoupiaoshu+"/"+personCount;
                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if(mmtoupiaoshu > mmPassNumber){
                                pinpaijieguo="通过";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                pinpaijieguo="不通过";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }
                        }else {
                            mmpiaoshu="";
                            pinpaijieguo = "";
                        }
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, pinpaijieguo,jieguocolor));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, mmpiaoshu,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(14, mmpinpaiKaishihang, 14, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(15, mmpinpaiKaishihang, 15, mmpinpaiKaishihang+mmPinpaiHebingshu);

                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }

                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);

                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void ThreeFivehuizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                               HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        HcjieguoExample hcjieguoExample=new HcjieguoExample();
        hcjieguoExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hcjieguo> jieguolist=  hcjieguoMapper.selectByExample(hcjieguoExample);

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 15, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,14); //宽度
            wsheet.setColumnView(15,14);  //宽度






            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 15, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));


            wsheet.addCell(new Label(14, 2, "品规结果",wcfFC));
            wsheet.addCell(new Label(15, 2, "品规票数",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);


            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();



                                int mmtoupiaoshu =  jieguolist.stream().filter(x -> x.getDetailid().equals(mmdetailId)
                                                &&x.getResult().equals("1"))
                                        .collect(Collectors.toList()).size();

                                String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(mmtoupiaoshu > mmPassNumber){
                                    mmjieguo="通过";
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不通过";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }

                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));


                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(15, mmxinghaoKaishihang, mmpiaoshu, wcfFC));
                                    wsheet.addCell(new Label(14, mmxinghaoKaishihang, mmjieguo, jieguocolor));
                                }else {
                                    wsheet.addCell(new Label(15, mmxinghaoKaishihang, "", wcfFC));
                                    wsheet.addCell(new Label(14, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);

                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }

                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);

                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void yuxuanhuihuizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                               HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();


        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        mmExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        HcjieguoExample hcjieguoExample=new HcjieguoExample();
        hcjieguoExample.createCriteria().andXiangmuidEqualTo(ppxiangmuid);
        List<Hcjieguo> jieguoList =  hcjieguoMapper.selectByExample(hcjieguoExample);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);
        int personCount = mmUserList.size();
        double mmPassNumber=2.0 / 3 * personCount;

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果表"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);


            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 16, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,14); //宽度
            wsheet.setColumnView(15,14);  //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("黑体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 15, 1);


            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));
            wsheet.addCell(new Label(14, 2, "投票结果",wcfFC));
            wsheet.addCell(new Label(15, 2, "表决结果",wcfFC));




            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();
                                String shiyongyuanze = pinguiOne.getBeizhu1() == null ? "" : pinguiOne.getBeizhu1();


                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));



                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        int mmtoupiaoshu =  jieguoList.stream().filter(x -> x.getPinzhong().equals(pinzhongOne.getZongxuhao())
                                        &&x.getPinpai().equals(pinpaiOne.getPinpai())
                                        &&x.getResult().equals("1"))
                                .filter(distinctByKey(k -> k.getUserid()))
                                .collect(Collectors.toList()).size();


                        String mmpiaoshu=mmtoupiaoshu+"/"+personCount;

                        String mmjieguo="";

                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1){
                            if (mmtoupiaoshu > mmPassNumber) {
                                mmjieguo = "通过";
                            } else {
                                mmjieguo = "不通过";
                            }
                        }else {
                            mmpiaoshu="";
                            mmjieguo = "";
                        }
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, mmjieguo,wcfFC));

                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        if(mmjieguo.equals("通过")){
                            wsheet.addCell(new Label(14, mmpinpaiKaishihang, mmjieguo,wcfFCt));
                        }else if(mmjieguo.equals("不通过")){
                            wsheet.addCell(new Label(14, mmpinpaiKaishihang, mmjieguo,wcfFCb));
                        }else
                            wsheet.addCell(new Label(14, mmpinpaiKaishihang, mmjieguo,wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, mmpiaoshu,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(14, mmpinpaiKaishihang, 14, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(15, mmpinpaiKaishihang, 15, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }
                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);

                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc1qianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserid,
                              HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc3Example mmExample=new Hc3Example();
        mmExample.setOrderByClause("ordernum");
        Hc3Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc3> mmList=hc3Mapper.selectByExample(mmExample);

        YltpJieguoExample yltpJieguo=new YltpJieguoExample();
        YltpJieguoExample.Criteria c = yltpJieguo.createCriteria();
        c.andUseridEqualTo(ppuserid);
        List<YltpJieguo> jieguolist=ddMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 12, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,10); //宽度
            wsheet.setColumnView(12,12); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 6, 1);

            wsheet.addCell(new Label(7, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(7, 1, 12, 1);

            wsheet.addCell(new Label(0, 2, "引进类型",wcfFC));
            wsheet.addCell(new Label(1, 2, "序号",wcfFC));
            wsheet.addCell(new Label(2, 2, "带量备注", wcfFC));
            wsheet.addCell(new Label(3, 2, "产品类别", wcfFC));
            wsheet.addCell(new Label(4, 2, "中标编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "注册证名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "生产商", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "价格", wcfFC));


            wsheet.addCell(new Label(12, 2, "表决结果",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            int mmKaishihang=3;
            int mmpinpaiKaishihang=mmKaishihang;
            int mmpinguiKaishihang=mmKaishihang;

            List<Hc3> pinpailist = mmList.stream()
                    .filter(distinctByKey(Hc3::getXuhao))
                    .collect(Collectors.toList());

            for (int j = 0; j < pinpailist.size(); j++) {
                int s=0;
                int mmPinpaiHebingshu = 0;
                Hc3 mmPinpaiOne = pinpailist.get(j);
                if (mmPinpaiOne!=null){
                    List<Hc3> pinguilist = mmList.stream().filter(x -> x.getXuhao().equals(mmPinpaiOne.getXuhao())).collect(Collectors.toList());
                    if (pinguilist.size()>0){
                        mmPinpaiHebingshu = pinguilist.size()-1;
                    }
                    for (int k = 0; k < pinguilist.size(); k++) {
                        Hc3 pinguiOne = pinguilist.get(k);
                        if (pinguiOne != null) {
                            String mmdetailId = pinguiOne.getId();
                            String yinjinleixing = pinguiOne.getBeizhu1() == null ? "" : pinguiOne.getBeizhu1();
                            String zongxuhao=pinguiOne.getXuhao()==null ? "" :pinguiOne.getXuhao().toString();
                            String dailiangbeizhu=pinguiOne.getBeizhu2()==null ? "" :pinguiOne.getBeizhu2().toString();
                            String chanpinleibie = pinguiOne.getBeizhu3() == null ? "" : pinguiOne.getBeizhu3();
                            String zhongbiaobianma = pinguiOne.getZhongbiaobianma() == null ? "" : pinguiOne.getZhongbiaobianma();
                            String zhucezhengmingcheng = pinguiOne.getBeizhu4() == null ? "" : pinguiOne.getBeizhu4();
                            String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                            String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                            String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                            String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                            String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                            String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                            String keshi = pinguiOne.getKeshi() == null ? "" : pinguiOne.getKeshi();
                            boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));

                            String mmjieguo="";

                            WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                            if(anyMatch){
                                mmjieguo="同意";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                mmjieguo="不同意";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }

                            wsheet.setRowView(mmpinguiKaishihang, 500);
                            wsheet.addCell(new Label(0, mmpinguiKaishihang,yinjinleixing,wcfFC));
                            wsheet.addCell(new Label(1, mmpinguiKaishihang,zongxuhao,wcfFC));
                            wsheet.addCell(new Label(2, mmpinguiKaishihang,dailiangbeizhu,wcfFC));
                            wsheet.addCell(new Label(3, mmpinguiKaishihang,chanpinleibie,wcfFC));
                            wsheet.addCell(new Label(4, mmpinguiKaishihang,zhongbiaobianma,wcfFC));
                            wsheet.addCell(new Label(5, mmpinguiKaishihang,zhucezhengmingcheng,wcfFC));
                            wsheet.addCell(new Label(6, mmpinguiKaishihang,guige,wcfFC));
                            wsheet.addCell(new Label(7, mmpinguiKaishihang,xinghao,wcfFC));
                            wsheet.addCell(new Label(8, mmpinguiKaishihang,zhucezheng,wcfFC));
                            wsheet.addCell(new Label(9, mmpinguiKaishihang,shengchanchangjia,wcfFC));
                            wsheet.addCell(new Label(10, mmpinguiKaishihang,danwei,wcfFC));
                            wsheet.addCell(new Label(11, mmpinguiKaishihang,danjia,wcfFC));

                            wsheet.addCell(new Label(12, mmpinguiKaishihang,mmjieguo,wcfFC));

                            mmpinguiKaishihang = mmpinguiKaishihang+1;
                        }
                    }

                    mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                }

            }

            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc6qianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserid,
                              HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc3Example mmExample=new Hc3Example();
        mmExample.setOrderByClause("ordernum");
        Hc3Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc3> mmList=hc3Mapper.selectByExample(mmExample);

        YltpJieguoExample yltpJieguo=new YltpJieguoExample();
        YltpJieguoExample.Criteria c = yltpJieguo.createCriteria();
        c.andUseridEqualTo(ppuserid);
        List<YltpJieguo> jieguolist=ddMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 7, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,12); //宽度
            wsheet.setColumnView(3,12); //宽度
            wsheet.setColumnView(4,12); //宽度
            wsheet.setColumnView(5,14); //宽度
            wsheet.setColumnView(6,14); //宽度
            wsheet.setColumnView(7,14); //宽度




            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 3, 1);

            wsheet.addCell(new Label(4, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(4, 1, 7, 1);

            wsheet.addCell(new Label(0, 2, "序号",wcfFC));
            wsheet.addCell(new Label(1, 2, "中标编码",wcfFC));
            wsheet.addCell(new Label(2, 2, "注册证名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "型号", wcfFC));
            wsheet.addCell(new Label(5, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产商", wcfFC));

            wsheet.addCell(new Label(7, 2, "表决结果",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            int mmKaishihang=3;
            int mmpinpaiKaishihang=mmKaishihang;
            int mmpinguiKaishihang=mmKaishihang;

            List<Hc3> pinpailist = mmList.stream()
                    .filter(distinctByKey(Hc3::getXuhao))
                    .collect(Collectors.toList());

            for (int j = 0; j < pinpailist.size(); j++) {
                int s=0;
                int mmPinpaiHebingshu = 0;
                Hc3 mmPinpaiOne = pinpailist.get(j);
                if (mmPinpaiOne!=null){
                    List<Hc3> pinguilist = mmList.stream().filter(x -> x.getXuhao().equals(mmPinpaiOne.getXuhao())).collect(Collectors.toList());
                    if (pinguilist.size()>0){
                        mmPinpaiHebingshu = pinguilist.size()-1;
                    }
                    for (int k = 0; k < pinguilist.size(); k++) {
                        Hc3 pinguiOne = pinguilist.get(k);
                        if (pinguiOne != null) {
                            String mmdetailId = pinguiOne.getId();
                            String zongxuhao=pinguiOne.getXuhao()==null ? "" :pinguiOne.getXuhao().toString();
                            String zhongbiaobianma = pinguiOne.getZhongbiaobianma() == null ? "" : pinguiOne.getZhongbiaobianma();
                            String zhucezhengmingcheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                            String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                            String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                            String zhucezheng = pinguiOne.getBeizhu1() == null ? "" : pinguiOne.getBeizhu1();
                            String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                            boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));

                            String mmjieguo="";

                            WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                            if(anyMatch){
                                mmjieguo="同意";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                mmjieguo="不同意";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }

                            wsheet.setRowView(mmpinguiKaishihang, 500);
                            wsheet.addCell(new Label(0, mmpinguiKaishihang,zongxuhao,wcfFC));
                            wsheet.addCell(new Label(1, mmpinguiKaishihang,zhongbiaobianma,wcfFC));
                            wsheet.addCell(new Label(2, mmpinguiKaishihang,zhucezhengmingcheng,wcfFC));
                            wsheet.addCell(new Label(3, mmpinguiKaishihang,guige,wcfFC));
                            wsheet.addCell(new Label(4, mmpinguiKaishihang,xinghao,wcfFC));
                            wsheet.addCell(new Label(5, mmpinguiKaishihang,zhucezheng,wcfFC));
                            wsheet.addCell(new Label(6, mmpinguiKaishihang,shengchanchangjia,wcfFC));

                            wsheet.addCell(new Label(7, mmpinguiKaishihang,mmjieguo,wcfFC));

                            mmpinguiKaishihang = mmpinguiKaishihang+1;
                        }
                    }

                    mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                }

            }

            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc2qianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                 @RequestParam("userid") String ppuserid,
                                 HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc2Example mmExample=new Hc2Example();
        mmExample.setOrderByClause("ordernum");
        Hc2Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc2> mmList=hc2Mapper.selectByExample(mmExample);

        YltpJieguoExample yltpJieguo=new YltpJieguoExample();
        YltpJieguoExample.Criteria c = yltpJieguo.createCriteria();
        c.andUseridEqualTo(ppuserid);
        List<YltpJieguo> jieguolist=ddMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 16, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,10); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,10); //宽度
            wsheet.setColumnView(16,10); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 7, 1);

            wsheet.addCell(new Label(8, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(8, 1, 16, 1);

            wsheet.addCell(new Label(0, 2, "引进类型",wcfFC));
            wsheet.mergeCells(0,2,0,3);
            wsheet.addCell(new Label(1, 2, "总序号",wcfFC));
            wsheet.mergeCells(1,2,1,3);
            wsheet.addCell(new Label(2, 2, "设备信息",wcfFC));
            wsheet.mergeCells(2,2,5,2);
            wsheet.addCell(new Label(2, 3, "设备名称",wcfFC));
            wsheet.addCell(new Label(3, 3, "设备型号",wcfFC));
            wsheet.addCell(new Label(4, 3, "设备来源",wcfFC));
            wsheet.addCell(new Label(5, 3, "设备品牌",wcfFC));

            wsheet.addCell(new Label(6, 2, "配套耗材（试剂）信息",wcfFC));
            wsheet.mergeCells(6,2,14,2);
            wsheet.addCell(new Label(6, 3, "平台编码",wcfFC));
            wsheet.addCell(new Label(7, 3, "产品名称",wcfFC));
            wsheet.addCell(new Label(8, 3, "规格",wcfFC));
            wsheet.addCell(new Label(9, 3, "型号",wcfFC));
            wsheet.addCell(new Label(10, 3, "注册证号",wcfFC));
            wsheet.addCell(new Label(11, 3, "生产厂家",wcfFC));
            wsheet.addCell(new Label(12, 3, "单位",wcfFC));
            wsheet.addCell(new Label(13, 3, "单价",wcfFC));
            wsheet.addCell(new Label(14, 3, "医保编码",wcfFC));


            wsheet.addCell(new Label(15, 2, "国产/进口",wcfFC));
            wsheet.mergeCells(15,2,15,3);


            wsheet.addCell(new Label(16, 2, "表决结果",wcfFC));
            wsheet.mergeCells(16,2,16,3);



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            int mmKaishihang=4;
            int mmpinpaiKaishihang=mmKaishihang;
            int mmpinguiKaishihang=mmKaishihang;

            List<Hc2> pinpailist = mmList.stream()
                    .filter(distinctByKey(Hc2::getShebeixinghao))
                    .collect(Collectors.toList());

            for (int j = 0; j < pinpailist.size(); j++) {
                int s=0;
                int mmPinpaiHebingshu = 0;
                Hc2 mmPinpaiOne = pinpailist.get(j);
                if (mmPinpaiOne!=null){
                    List<Hc2> pinguilist = mmList.stream().filter(x -> x.getShebeixinghao().equals(mmPinpaiOne.getShebeixinghao())).collect(Collectors.toList());
                    if (pinguilist.size()>0){
                        mmPinpaiHebingshu = pinguilist.size()-1;
                    }
                    for (int k = 0; k < pinguilist.size(); k++) {
                        Hc2 pinguiOne = pinguilist.get(k);
                        if (pinguiOne != null) {
                            String mmdetailId = pinguiOne.getId();
                            String yinjinleixing = pinguiOne.getYinjinleixing() == null ? "" : pinguiOne.getYinjinleixing();
                            Integer zongxuhao = pinguiOne.getZongxuhao();
                            String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                            String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                            String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                            String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                            String zhucezhenghao = pinguiOne.getZhucezhenghao() == null ? "" : pinguiOne.getZhucezhenghao();
                            String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                            String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                            String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                            String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                            String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();
                            boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));

                            String mmjieguo="";

                            WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                            if(anyMatch){
                                mmjieguo="同意";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                mmjieguo="不同意";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }

                            wsheet.setRowView(mmpinguiKaishihang, 500); // 设置第3行的行高为500
                            wsheet.addCell(new Label(0, mmpinguiKaishihang,yinjinleixing,wcfFC));
                            wsheet.addCell(new Label(1, mmpinguiKaishihang,zongxuhao.toString(),wcfFC));
                            wsheet.addCell(new Label(6, mmpinguiKaishihang, pingtaibianma, wcfFC));
                            wsheet.addCell(new Label(7, mmpinguiKaishihang, chanpinmingcheng, wcfFC));
                            wsheet.addCell(new Label(8, mmpinguiKaishihang, guige, wcfFC));
                            wsheet.addCell(new Label(9, mmpinguiKaishihang, xinghao, wcfFC));
                            wsheet.addCell(new Label(10, mmpinguiKaishihang, zhucezhenghao, wcfFC));
                            wsheet.addCell(new Label(11, mmpinguiKaishihang, shengchanchangjia, wcfFC));
                            wsheet.addCell(new Label(12, mmpinguiKaishihang, danwei, wcfFC));
                            wsheet.addCell(new Label(13, mmpinguiKaishihang, danjia, wcfFC));
                            wsheet.addCell(new Label(14, mmpinguiKaishihang, yibaobianma, wcfFC));
                            wsheet.addCell(new Label(15, mmpinguiKaishihang, guochanjinkou, wcfFC));


                            wsheet.addCell(new Label(16, mmpinguiKaishihang,mmjieguo,wcfFC));

                            mmpinguiKaishihang = mmpinguiKaishihang+1;
                        }
                    }

                    String shebeimingcheng = mmPinpaiOne.getShebeimingcheng() == null ? "" : mmPinpaiOne.getShebeimingcheng();
                    String shebeixinghao = mmPinpaiOne.getShebeixinghao() == null ? "" : mmPinpaiOne.getShebeixinghao();
                    String shebeilaiyuan = mmPinpaiOne.getShebeilaiyuan() == null ? "" : mmPinpaiOne.getShebeilaiyuan();
                    String shebeipinpai = mmPinpaiOne.getBeizhu1() == null ? "" : mmPinpaiOne.getBeizhu1();


                    wsheet.addCell(new Label(2, mmpinpaiKaishihang, shebeimingcheng, wcfFC));
                    wsheet.addCell(new Label(3, mmpinpaiKaishihang, shebeixinghao, wcfFC));
                    wsheet.addCell(new Label(4, mmpinpaiKaishihang, shebeilaiyuan, wcfFC));
                    wsheet.addCell(new Label(5, mmpinpaiKaishihang, shebeipinpai, wcfFC));
                    wsheet.mergeCells(2, mmpinpaiKaishihang, 2, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(4, mmpinpaiKaishihang, 4, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(5, mmpinpaiKaishihang, 5, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                }

            }

            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc3qianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                 @RequestParam("userid") String ppuserid,
                                 HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc2Example mmExample=new Hc2Example();
        mmExample.setOrderByClause("ordernum");
        Hc2Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc2> mmList=hc2Mapper.selectByExample(mmExample);

        YltpJieguoExample yltpJieguo=new YltpJieguoExample();
        YltpJieguoExample.Criteria c = yltpJieguo.createCriteria();
        c.andUseridEqualTo(ppuserid);
        List<YltpJieguo> jieguolist=ddMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 18, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,10); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,10); //宽度
            wsheet.setColumnView(16,10); //宽度
            wsheet.setColumnView(17,10); //宽度
            wsheet.setColumnView(18,10); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 8, 1);

            wsheet.addCell(new Label(9, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(9, 1, 18, 1);

            wsheet.addCell(new Label(0, 2, "引进类型",wcfFC));
            wsheet.mergeCells(0,2,0,3);
            wsheet.addCell(new Label(1, 2, "总序号",wcfFC));
            wsheet.mergeCells(1,2,1,3);
            wsheet.addCell(new Label(2, 2, "设备信息",wcfFC));
            wsheet.mergeCells(2,2,7,2);
            wsheet.addCell(new Label(2, 3, "设备名称",wcfFC));
            wsheet.addCell(new Label(3, 3, "设备型号",wcfFC));
            wsheet.addCell(new Label(4, 3, "设备来源",wcfFC));
            wsheet.addCell(new Label(5, 3, "启用日期",wcfFC));
            wsheet.addCell(new Label(6, 3, "设备序列号",wcfFC));
            wsheet.addCell(new Label(7, 3, "设备生产厂家",wcfFC));

            wsheet.addCell(new Label(8, 2, "配套耗材（试剂）信息",wcfFC));
            wsheet.mergeCells(8,2,16,2);
            wsheet.addCell(new Label(8, 3, "平台编码",wcfFC));
            wsheet.addCell(new Label(9, 3, "产品名称",wcfFC));
            wsheet.addCell(new Label(10, 3, "规格",wcfFC));
            wsheet.addCell(new Label(11, 3, "型号",wcfFC));
            wsheet.addCell(new Label(12, 3, "注册证号",wcfFC));
            wsheet.addCell(new Label(13, 3, "生产厂家",wcfFC));
            wsheet.addCell(new Label(14, 3, "单位",wcfFC));
            wsheet.addCell(new Label(15, 3, "单价",wcfFC));
            wsheet.addCell(new Label(16, 3, "医保编码",wcfFC));


            wsheet.addCell(new Label(17, 2, "国产/进口",wcfFC));
            wsheet.mergeCells(17,2,17,3);


            wsheet.addCell(new Label(18, 2, "表决结果",wcfFC));
            wsheet.mergeCells(18,2,18,3);



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            int mmKaishihang=4;
            int mmpinpaiKaishihang=mmKaishihang;
            int mmpinguiKaishihang=mmKaishihang;

            List<Hc2> pinpailist = mmList.stream()
                    .filter(distinctByKey(Hc2::getShebeixinghao))
                    .collect(Collectors.toList());

            for (int j = 0; j < pinpailist.size(); j++) {
                int s=0;
                int mmPinpaiHebingshu = 0;
                Hc2 mmPinpaiOne = pinpailist.get(j);
                if (mmPinpaiOne!=null){
                    List<Hc2> pinguilist = mmList.stream().filter(x -> x.getShebeixinghao().equals(mmPinpaiOne.getShebeixinghao())).collect(Collectors.toList());
                    if (pinguilist.size()>0){
                        mmPinpaiHebingshu = pinguilist.size()-1;
                    }
                    for (int k = 0; k < pinguilist.size(); k++) {
                        Hc2 pinguiOne = pinguilist.get(k);
                        if (pinguiOne != null) {
                            String mmdetailId = pinguiOne.getId();
                            String yinjinleixing = pinguiOne.getYinjinleixing() == null ? "" : pinguiOne.getYinjinleixing();
                            Integer zongxuhao = pinguiOne.getZongxuhao();
                            String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                            String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                            String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                            String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                            String zhucezhenghao = pinguiOne.getZhucezhenghao() == null ? "" : pinguiOne.getZhucezhenghao();
                            String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                            String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                            String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                            String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                            String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();
                            boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));

                            String mmjieguo="";

                            WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                            if(anyMatch){
                                mmjieguo="同意";
                                jieguocolor = new WritableCellFormat(wcfFCt);
                            }else {
                                mmjieguo="不同意";
                                jieguocolor = new WritableCellFormat(wcfFCb);
                            }

                            wsheet.setRowView(mmpinguiKaishihang, 500); // 设置第3行的行高为500
                            wsheet.addCell(new Label(0, mmpinguiKaishihang,yinjinleixing,wcfFC));
                            wsheet.addCell(new Label(1, mmpinguiKaishihang,zongxuhao.toString(),wcfFC));
                            wsheet.addCell(new Label(8, mmpinguiKaishihang, pingtaibianma, wcfFC));
                            wsheet.addCell(new Label(9, mmpinguiKaishihang, chanpinmingcheng, wcfFC));
                            wsheet.addCell(new Label(10, mmpinguiKaishihang, guige, wcfFC));
                            wsheet.addCell(new Label(11, mmpinguiKaishihang, xinghao, wcfFC));
                            wsheet.addCell(new Label(12, mmpinguiKaishihang, zhucezhenghao, wcfFC));
                            wsheet.addCell(new Label(13, mmpinguiKaishihang, shengchanchangjia, wcfFC));
                            wsheet.addCell(new Label(14, mmpinguiKaishihang, danwei, wcfFC));
                            wsheet.addCell(new Label(15, mmpinguiKaishihang, danjia, wcfFC));
                            wsheet.addCell(new Label(16, mmpinguiKaishihang, yibaobianma, wcfFC));
                            wsheet.addCell(new Label(17, mmpinguiKaishihang, guochanjinkou, wcfFC));


                            wsheet.addCell(new Label(18, mmpinguiKaishihang,mmjieguo,wcfFC));

                            mmpinguiKaishihang = mmpinguiKaishihang+1;
                        }
                    }

                    String shebeimingcheng = mmPinpaiOne.getShebeimingcheng() == null ? "" : mmPinpaiOne.getShebeimingcheng();
                    String shebeixinghao = mmPinpaiOne.getShebeixinghao() == null ? "" : mmPinpaiOne.getShebeixinghao();
                    String shebeilaiyuan = mmPinpaiOne.getShebeilaiyuan() == null ? "" : mmPinpaiOne.getShebeilaiyuan();
                    String qiyongriqi = mmPinpaiOne.getQiyongriqi() == null ? "" : mmPinpaiOne.getQiyongriqi();
                    String shebeixuliehao = mmPinpaiOne.getShebeixuliehao() == null ? "" : mmPinpaiOne.getShebeixuliehao();
                    String shebeishengchanchangjia = mmPinpaiOne.getShebeishengchanchangjia() == null ? "" : mmPinpaiOne.getShebeishengchanchangjia();


                    wsheet.addCell(new Label(2, mmpinpaiKaishihang, shebeimingcheng, wcfFC));
                    wsheet.addCell(new Label(3, mmpinpaiKaishihang, shebeixinghao, wcfFC));
                    wsheet.addCell(new Label(4, mmpinpaiKaishihang, shebeilaiyuan, wcfFC));
                    wsheet.addCell(new Label(5, mmpinpaiKaishihang, qiyongriqi, wcfFC));
                    wsheet.addCell(new Label(6, mmpinpaiKaishihang, shebeixuliehao, wcfFC));
                    wsheet.addCell(new Label(7, mmpinpaiKaishihang, shebeishengchanchangjia, wcfFC));
                    wsheet.mergeCells(2, mmpinpaiKaishihang, 2, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(4, mmpinpaiKaishihang, 4, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(5, mmpinpaiKaishihang, 5, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(6, mmpinpaiKaishihang, 6, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    wsheet.mergeCells(7, mmpinpaiKaishihang, 7, mmpinpaiKaishihang+mmPinpaiHebingshu);
                    mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                }

            }

            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc4qianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserid,
                              HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        HcjieguoExample yltpJieguo=new HcjieguoExample();
        yltpJieguo.createCriteria().andUseridEqualTo(ppuserid);
        List<Hcjieguo> jieguolist=hcjieguoMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 17, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,10);  //宽度
            wsheet.setColumnView(16,12); //宽度
            wsheet.setColumnView(17,12); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 8, 1);

            wsheet.addCell(new Label(9, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(9, 1, 17, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "申请科室", wcfFC));

            wsheet.addCell(new Label(16, 2, "品牌结果",wcfFC));
            wsheet.addCell(new Label(17, 2, "品规结果",wcfFC));




            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    int pinpaijieguo = -1;
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String wuzibianma = pinguiOne.getWuzibianma() == null ? "" : pinguiOne.getWuzibianma();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();
                                String keshi = pinguiOne.getKeshi() == null ? "" : pinguiOne.getKeshi();
                                boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));


                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(anyMatch){
                                    mmjieguo="同意";
                                    pinpaijieguo = 1;
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不同意";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }

                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));
                                wsheet.addCell(new Label(15, mmxinghaoKaishihang, keshi, wcfFC));


                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(17, mmxinghaoKaishihang, mmjieguo, wcfFC));
                                }else {
                                    wsheet.addCell(new Label(17, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        String mmjieguo="";

                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if (pinpaijieguo == 1) {
                                mmjieguo = "同意";
                            } else {
                                mmjieguo = "不同意";
                            }
                        }else  mmjieguo = "";
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, mmjieguo,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(16, mmpinpaiKaishihang, 16, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }
                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                String beizhu = pinzhongOne.getBeizhu() == null ? "" : pinzhongOne.getBeizhu();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.addCell(new Label(14, mmpinzhongKaishihang, beizhu,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(14, mmpinzhongKaishihang, 14, mmpinzhongKaishihang+mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void hc5qianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserid,
                              HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        HcjieguoExample yltpJieguo=new HcjieguoExample();
        yltpJieguo.createCriteria().andUseridEqualTo(ppuserid);
        List<Hcjieguo> jieguolist=hcjieguoMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 17, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,10);  //宽度
            wsheet.setColumnView(16,12); //宽度
            wsheet.setColumnView(17,12); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 7, 1);

            wsheet.addCell(new Label(8, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(8, 1, 17, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "申请科室", wcfFC));


            wsheet.addCell(new Label(16, 2, "品牌结果",wcfFC));
            wsheet.addCell(new Label(17, 2, "品规结果",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    int pinpaijieguo = -1;
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();
                                String shenqingkeshi = pinguiOne.getKeshi() == null ? "" : pinguiOne.getKeshi();

                                boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));


                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(anyMatch){
                                    mmjieguo="同意";
                                    pinpaijieguo = 1;
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不同意";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }
                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));
                                wsheet.addCell(new Label(15, mmxinghaoKaishihang, shenqingkeshi, wcfFC));

                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(17, mmxinghaoKaishihang, mmjieguo, wcfFC));
                                }else {
                                    wsheet.addCell(new Label(17, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        String mmjieguo="";

                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if (pinpaijieguo == 1) {
                                mmjieguo = "同意";
                            } else {
                                mmjieguo = "不同意";
                            }
                        }else  mmjieguo = "";
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, mmjieguo,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(16, mmpinpaiKaishihang, 16, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }
                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                String beizhu = pinzhongOne.getBeizhu() == null ? "" : pinzhongOne.getBeizhu();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.addCell(new Label(14, mmpinzhongKaishihang, beizhu,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(14, mmpinzhongKaishihang, 14, mmpinzhongKaishihang+mmHebingshu);

                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void Oneqianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserid,
                              HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        HcjieguoExample yltpJieguo=new HcjieguoExample();
        yltpJieguo.createCriteria().andUseridEqualTo(ppuserid);
        List<Hcjieguo> jieguolist=hcjieguoMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 15, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,12);  //宽度




            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 6, 1);

            wsheet.addCell(new Label(7, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(7, 1, 15, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));



            wsheet.addCell(new Label(14, 2, "品牌表决",wcfFC));
            wsheet.addCell(new Label(15, 2, "品规表决",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);
                int pinzhongjieguo = -1;

                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    int pinpaijieguo = -1;
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();


                                boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));


                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(anyMatch){
                                    mmjieguo="同意";
                                    pinpaijieguo = 1;
                                    pinzhongjieguo = 1;
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不同意";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }
                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));


                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(15, mmxinghaoKaishihang, mmjieguo, wcfFC));
                                }else {
                                    wsheet.addCell(new Label(15, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        String mmjieguo="";

                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if (pinpaijieguo == 1) {
                                mmjieguo = "同意";
                            } else {
                                mmjieguo = "不同意";
                            }
                        }else  mmjieguo = "";
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, mmjieguo,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(14, mmpinpaiKaishihang, 14, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }


                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);


                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void OnePinzhongqianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserid,
                              HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        HcjieguoExample yltpJieguo=new HcjieguoExample();
        yltpJieguo.createCriteria().andUseridEqualTo(ppuserid);
        List<Hcjieguo> jieguolist=hcjieguoMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 13, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度




            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 5, 1);

            wsheet.addCell(new Label(6, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(6, 1, 13, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "单位", wcfFC));
            wsheet.addCell(new Label(10, 2, "单价", wcfFC));
            wsheet.addCell(new Label(11, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(12, 2, "国产/进口", wcfFC));



            wsheet.addCell(new Label(13, 2, "品种表决",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);
                int pinzhongjieguo = -1;

                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    int pinpaijieguo = -1;
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();


                                boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));


                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(anyMatch){
                                    mmjieguo="同意";
                                    pinpaijieguo = 1;
                                    pinzhongjieguo = 1;
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不同意";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }
                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, guochanjinkou, wcfFC));

                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        String mmjieguo="";

                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if (pinpaijieguo == 1) {
                                mmjieguo = "同意";
                            } else {
                                mmjieguo = "不同意";
                            }
                        }else  mmjieguo = "";
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));

                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);

                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }
                String mmjieguo="";


                if (pinzhongjieguo == 1) {
                        mmjieguo = "同意";
                } else {
                        mmjieguo = "不同意";
                    }

                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.addCell(new Label(13, mmpinzhongKaishihang, mmjieguo,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(13, mmpinzhongKaishihang, 13, mmpinzhongKaishihang+mmHebingshu);

                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void TwoFourqianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserid,
                              HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        HcjieguoExample yltpJieguo=new HcjieguoExample();
        yltpJieguo.createCriteria().andUseridEqualTo(ppuserid);
        List<Hcjieguo> jieguolist=hcjieguoMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 15, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,12); //宽度
            wsheet.setColumnView(15,12);  //宽度




            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 6, 1);

            wsheet.addCell(new Label(7, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(7, 1, 15, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));


            wsheet.addCell(new Label(14, 2, "品牌表决",wcfFC));
            wsheet.addCell(new Label(15, 2, "品规表决",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);
                int pinzhongjieguo = -1;

                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    int pinpaijieguo = -1;
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();


                                boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));


                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(anyMatch){
                                    mmjieguo="同意";
                                    pinpaijieguo = 1;
                                    pinzhongjieguo = 1;
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不同意";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }
                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));


                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(15, mmxinghaoKaishihang, mmjieguo, wcfFC));
                                }else {
                                    wsheet.addCell(new Label(15, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        String mmjieguo="";

                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if (pinpaijieguo == 1) {
                                mmjieguo = "同意";
                            } else {
                                mmjieguo = "不同意";
                            }
                        }else  mmjieguo = "";
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, mmjieguo,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(14, mmpinpaiKaishihang, 14, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }

                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);


                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void ThreeFiveqianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserid,
                              HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        HcjieguoExample yltpJieguo=new HcjieguoExample();
        yltpJieguo.createCriteria().andUseridEqualTo(ppuserid);
        List<Hcjieguo> jieguolist=hcjieguoMapper.selectByExample(yltpJieguo);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 14, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,12); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 6, 1);

            wsheet.addCell(new Label(7, 1, "投票人（签字）：投票内容已核对无误。"+mmusername,wcfFC2));
            wsheet.mergeCells(7, 1, 14, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "总序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));

            wsheet.addCell(new Label(14, 2, "品规表决",wcfFC));



            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCb.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(Alignment.CENTRE);
            wcfFCb.setWrap(true);
            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFCt.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(Alignment.CENTRE);
            wcfFCt.setWrap(true);

            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);
                int pinzhongjieguo = -1;

                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    int pinpaijieguo = -1;
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String shengchanchangjia = pinguiOne.getShengchanchangjia() == null ? "" : pinguiOne.getShengchanchangjia();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();


                                boolean anyMatch = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));


                                String mmjieguo="";

                                WritableCellFormat jieguocolor = new WritableCellFormat(wcfFC);
                                if(anyMatch){
                                    mmjieguo="同意";
                                    pinpaijieguo = 1;
                                    pinzhongjieguo = 1;
                                    jieguocolor = new WritableCellFormat(wcfFCt);
                                }else {
                                    mmjieguo="不同意";
                                    jieguocolor = new WritableCellFormat(wcfFCb);
                                }
                                wsheet.setRowView(mmxinghaoKaishihang, 500); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));


                                if (pinguiOne.getIsvote()==1){
                                    wsheet.addCell(new Label(14, mmxinghaoKaishihang, mmjieguo, wcfFC));
                                }else {
                                    wsheet.addCell(new Label(14, mmxinghaoKaishihang, "", wcfFC));
                                }
                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }

                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);

                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void yuxuanhuiqianzibiao(@RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserid,
                              HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        Hc45Example mmExample=new Hc45Example();
        mmExample.setOrderByClause("ordernum");
        Hc45Example.Criteria criteria = mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(ppxiangmuid);
        List<Hc45> mmList=hc45Mapper.selectByExample(mmExample);

        HcjieguoExample yltpJieguo=new HcjieguoExample();
        yltpJieguo.createCriteria().andUseridEqualTo(ppuserid).andXiangmuidEqualTo(ppxiangmuid);
        List<Hcjieguo> jieguolist=hcjieguoMapper.selectByExample(yltpJieguo);


        YiyongyuanzeExample yiyongyuanzeExample=new YiyongyuanzeExample();
        yiyongyuanzeExample.createCriteria().andUseridEqualTo(ppuserid).andXiangmuidEqualTo(ppxiangmuid);
        List<Yiyongyuanze> yuanzelist=yiyongyuanzeMapper.selectByExample(yiyongyuanzeExample);

        YltpUser mmuser=ddYltpuserService.findOne(ppuserid);
        String mmusername=mmuser.getUsername();
        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();
        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+mmusername+"委员签字表"+ StringHandle.tiemString(); //文件名
            String tmptitle = mmxiangmuname+"表决票"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,800); //第一行高度
            wsheet.setRowView(1,600); //第二行高度
            wsheet.mergeCells(0, 0, 16, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,10); //宽度
            wsheet.setColumnView(1,10); //宽度
            wsheet.setColumnView(2,10); //宽度
            wsheet.setColumnView(3,10); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,10); //宽度
            wsheet.setColumnView(9,12); //宽度
            wsheet.setColumnView(10,10); //宽度
            wsheet.setColumnView(11,12); //宽度
            wsheet.setColumnView(12,10); //宽度
            wsheet.setColumnView(13,14); //宽度
            wsheet.setColumnView(14,10); //宽度
            wsheet.setColumnView(15,14);  //宽度
            wsheet.setColumnView(16,20); //宽度




            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 8, 1);

            wsheet.addCell(new Label(9, 1, "签名："+mmusername,wcfFC2));
            wsheet.mergeCells(9, 1, 15, 1);

            wsheet.addCell(new Label(0, 2, "引进类型", wcfFC));
            wsheet.addCell(new Label(1, 2, "序号", wcfFC));
            wsheet.addCell(new Label(2, 2, "品种名", wcfFC));
            wsheet.addCell(new Label(3, 2, "品牌序号", wcfFC));
            wsheet.addCell(new Label(4, 2, "平台编码", wcfFC));
            wsheet.addCell(new Label(5, 2, "产品名称", wcfFC));
            wsheet.addCell(new Label(6, 2, "规格", wcfFC));
            wsheet.addCell(new Label(7, 2, "型号", wcfFC));
            wsheet.addCell(new Label(8, 2, "注册证号", wcfFC));
            wsheet.addCell(new Label(9, 2, "品牌名", wcfFC));
            wsheet.addCell(new Label(10, 2, "单位", wcfFC));
            wsheet.addCell(new Label(11, 2, "单价", wcfFC));
            wsheet.addCell(new Label(12, 2, "医保编码", wcfFC));
            wsheet.addCell(new Label(13, 2, "国产/进口", wcfFC));
            wsheet.addCell(new Label(14, 2, "表决结果", wcfFC));
            wsheet.addCell(new Label(15, 2, "适用原则", wcfFC));




            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 8,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);


            List<Hc45> pinzhonglist = mmList.stream()
                    .filter(distinctByKey(Hc45::getZongxuhao))
                    .collect(Collectors.toList());
            int count=pinzhonglist.size();
            int mmpinzhongKaishihang=3;
            int mmpinpaiKaishihang=3;
            int mmxinghaoKaishihang=3;

            for(int i=0;i<count;i++){
                Hc45 pinzhongOne=pinzhonglist.get(i);


                int mmHebingshu = 0;

                List<Hc45> mmPinpailist = mmList.stream().filter(x -> x.getZongxuhao().equals(pinzhongOne.getZongxuhao() )).filter(distinctByKey(Hc45::getPinpai)).collect(Collectors.toList());

                if (mmPinpailist.size()>0){
                    mmHebingshu = mmPinpailist.size()-1;
                }

                for (int j = 0; j < mmPinpailist.size(); j++) {
                    int s=0;
                    int mmPinpaiHebingshu = 0;
                    int pinpaijieguo = -1;
                    Hc45 pinpaiOne = mmPinpailist.get(j);
                    if (pinpaiOne!=null){
                        List<Hc45> pinguilist = mmList.stream().filter(x -> x.getPinpai().equals(pinpaiOne.getPinpai())&&x.getZongxuhao().equals(pinzhongOne.getZongxuhao())).collect(Collectors.toList());
                        if (pinguilist.size()>0){
                            mmPinpaiHebingshu = pinguilist.size()-1;
                            mmHebingshu += mmPinpaiHebingshu;
                        }
                        for (int k = 0; k < pinguilist.size(); k++) {
                            Hc45 pinguiOne = pinguilist.get(k);
                            if (pinguiOne != null) {
                                String mmdetailId = pinguiOne.getId();
                                String pingtaibianma = pinguiOne.getPingtaibianma() == null ? "" : pinguiOne.getPingtaibianma();
                                String chanpinmingcheng = pinguiOne.getChanpinmingcheng() == null ? "" : pinguiOne.getChanpinmingcheng();
                                String guige = pinguiOne.getGuige() == null ? "" : pinguiOne.getGuige();
                                String xinghao = pinguiOne.getXinghao() == null ? "" : pinguiOne.getXinghao();
                                String zhucezheng = pinguiOne.getZhucezheng() == null ? "" : pinguiOne.getZhucezheng();
                                String pinpaiming = pinguiOne.getPinpaiming() == null ? "" : pinguiOne.getPinpaiming();
                                String danwei = pinguiOne.getDanwei() == null ? "" : pinguiOne.getDanwei();
                                String danjia = pinguiOne.getDanjia() == null ? "" : pinguiOne.getDanjia();
                                String yibaobianma = pinguiOne.getYibaobianma() == null ? "" : pinguiOne.getYibaobianma();
                                String guochanjinkou = pinguiOne.getGuochanjinkou() == null ? "" : pinguiOne.getGuochanjinkou();



                                boolean pinguijieguo = jieguolist.stream().anyMatch(x -> x.getDetailid().equals(mmdetailId)&&x.getResult().equals("1"));


                                if(pinguijieguo){
                                    pinpaijieguo=1;
                                }

                                wsheet.setRowView(mmxinghaoKaishihang, 700); // 设置第3行的行高为21
                                wsheet.addCell(new Label(4, mmxinghaoKaishihang, pingtaibianma, wcfFC));
                                wsheet.addCell(new Label(5, mmxinghaoKaishihang, chanpinmingcheng, wcfFC));
                                wsheet.addCell(new Label(6, mmxinghaoKaishihang, guige, wcfFC));
                                wsheet.addCell(new Label(7, mmxinghaoKaishihang, xinghao, wcfFC));
                                wsheet.addCell(new Label(8, mmxinghaoKaishihang, zhucezheng, wcfFC));
                                wsheet.addCell(new Label(9, mmxinghaoKaishihang, pinpaiming, wcfFC));
                                wsheet.addCell(new Label(10, mmxinghaoKaishihang, danwei, wcfFC));
                                wsheet.addCell(new Label(11, mmxinghaoKaishihang, danjia, wcfFC));
                                wsheet.addCell(new Label(12, mmxinghaoKaishihang, yibaobianma, wcfFC));
                                wsheet.addCell(new Label(13, mmxinghaoKaishihang, guochanjinkou, wcfFC));


                                mmxinghaoKaishihang = mmxinghaoKaishihang+1;
                            }
                        }
                        String pinpaixuhao = pinpaiOne.getPinpai() == null ? "" : pinpaiOne.getPinpai();
                        Optional<Yiyongyuanze> mmyuanze= yuanzelist.stream().filter(x -> x.getPinzhong().equals(pinzhongOne.getZongxuhao())&&x.getPinpai().equals(pinpaiOne.getPinpai())).findFirst();
                        String shiyongyuanze = new String("");
                        if(mmyuanze.isPresent()&&pinpaijieguo==1) {
                            shiyongyuanze = new String(mmyuanze.get().getShiyongyuanzeid());
                        }

                        String mmjieguo="";

                        if(pinpaiOne.getPinpai().indexOf("待选")!=-1)
                        {
                            if (pinpaijieguo == 1) {
                                mmjieguo = "同意";
                            } else {
                                mmjieguo = "不同意";
                            }
                        }else  mmjieguo = "";

                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, pinpaixuhao,wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, shiyongyuanze,wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, mmjieguo,wcfFC));
                        wsheet.mergeCells(3, mmpinpaiKaishihang, 3, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(14, mmpinpaiKaishihang, 14, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        wsheet.mergeCells(15, mmpinpaiKaishihang, 15, mmpinpaiKaishihang+mmPinpaiHebingshu);
                        mmpinpaiKaishihang = mmpinpaiKaishihang+mmPinpaiHebingshu+1;
                    }
                }
                String yinjinleixing = pinzhongOne.getYinjinleixing() == null ? "" : pinzhongOne.getYinjinleixing();
                String zongxuhao = pinzhongOne.getZongxuhao() == null ? "" : pinzhongOne.getZongxuhao().toString();
                String pinzhongming = pinzhongOne.getPinzhongming() == null ? "" : pinzhongOne.getPinzhongming();
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, yinjinleixing,wcfFC));
                wsheet.addCell(new Label(1, mmpinzhongKaishihang, zongxuhao,wcfFC));
                wsheet.addCell(new Label(2, mmpinzhongKaishihang, pinzhongming,wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(1, mmpinzhongKaishihang, 1, mmpinzhongKaishihang+mmHebingshu);
                wsheet.mergeCells(2, mmpinzhongKaishihang, 2, mmpinzhongKaishihang+mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang+mmHebingshu+1;

            }
            wbook.write(); // 写入文件
            wbook.close();

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    //引进汇总表
    public void yinjinhuizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                 HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        //取项目中填的通过数
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();
        List<YltpYinjin> mmList=ddYltpyinjinService.findyinjinlist(ppxiangmuid);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,500); //第一行高度
            wsheet.setRowView(1,500); //第一行高度
            wsheet.mergeCells(0, 0, 8, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,6); //宽度
            wsheet.setColumnView(1,22); //宽度
            wsheet.setColumnView(2,33); //宽度
            wsheet.setColumnView(3,33); //宽度
            wsheet.setColumnView(4,6); //宽度
            wsheet.setColumnView(5,10); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,15); //宽度
            wsheet.setColumnView(8,10); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableCellFormat wcfFCt = new WritableCellFormat(wfont);
            //设置背景颜色;
            wcfFCt.setBackground(jxl.format.Colour.GREEN);
            wcfFCt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFCt.setVerticalAlignment(jxl.write.VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCt.setAlignment(jxl.write.Alignment.CENTRE);

            WritableCellFormat wcfFCb = new WritableCellFormat(wfont);
            //设置背景颜色;
            wcfFCb.setBackground(jxl.format.Colour.RED);
            wcfFCb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFCb.setVerticalAlignment(jxl.write.VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFCb.setAlignment(jxl.write.Alignment.CENTRE);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 2, 1);


            wsheet.addCell(new Label(6, 1, "单位：万元",wcfFC2));
            wsheet.mergeCells(6, 1, 8, 1);

            wsheet.addCell(new Label(0, 2, "序号",wcfFC));
            wsheet.addCell(new Label(1, 2, "科室名称",wcfFC));
            wsheet.addCell(new Label(2, 2, "设备名称",wcfFC));
            wsheet.addCell(new Label(3, 2, "通用名称",wcfFC));
            wsheet.addCell(new Label(4, 2, "数量",wcfFC));
            wsheet.addCell(new Label(5, 2, "预算单价",wcfFC));
            wsheet.addCell(new Label(6, 2, "预算金额",wcfFC));
            wsheet.addCell(new Label(7, 2, "投票结果",wcfFC));
            wsheet.addCell(new Label(8, 2, "表决结果",wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int mmKaishihang=3;

            for(int i=0;i<mmList.size();i++){
                YltpYinjin mmYltpYinjin=mmList.get(i);
                String mmXuhao = String.valueOf(i + 1);
                String mmshiyongkeshi=mmYltpYinjin.getShiyongkeshi()==null ? "" :mmYltpYinjin.getShiyongkeshi();
                String mmshebeimingcheng=mmYltpYinjin.getShebeimingcheng()==null ? "" :mmYltpYinjin.getShebeimingcheng();
                String mmshuliang=mmYltpYinjin.getShuliang()==null ? "" :mmYltpYinjin.getShuliang();
                String mmdanjia=mmYltpYinjin.getDanjia()==null ? "" :mmYltpYinjin.getDanjia();
                String mmyusuanjine=mmYltpYinjin.getYusuanjine()==null ? "" :mmYltpYinjin.getYusuanjine();
                String mmshebeileixing=mmYltpYinjin.getShebeimingcheng()==null ? "" :mmYltpYinjin.getShebeimingcheng();
                String mmtongyongmingcheng=mmYltpYinjin.getTongyongmingcheng()==null ?"":mmYltpYinjin.getTongyongmingcheng();
                String mmbeizhu=mmYltpYinjin.getBeizhu()==null ?"":mmYltpYinjin.getBeizhu();
                String mmdetailId=mmYltpYinjin.getId()==null ? "" :mmYltpYinjin.getId();
                int mmtoupiaoshu=ddService.getCountBydetailIdandResult(mmdetailId,"1");
                int mmzongshu=mmUserList.size();

                String mmpiaoshu="投票数"+mmtoupiaoshu+"/总数"+mmzongshu;

                String mmjieguo="";
                if(mmtoupiaoshu>=mmtongguoshu){
                    mmjieguo="通过";
                }else {
                    mmjieguo="不通过";
                }

                wsheet.addCell(new Label(0, mmKaishihang,mmXuhao,wcfFC));
                wsheet.addCell(new Label(1, mmKaishihang, mmshiyongkeshi,wcfFC));
                wsheet.addCell(new Label(2, mmKaishihang,mmshebeimingcheng,wcfFC));
                wsheet.addCell(new Label(3, mmKaishihang,mmtongyongmingcheng,wcfFC));
                wsheet.addCell(new Label(4, mmKaishihang,mmshuliang,wcfFC));
                wsheet.addCell(new Label(5, mmKaishihang,mmdanjia,wcfFC));
                wsheet.addCell(new Label(6, mmKaishihang,mmyusuanjine,wcfFC));
                wsheet.addCell(new Label(7, mmKaishihang,mmpiaoshu,wcfFC));
                if(mmjieguo=="通过"){
                    wsheet.addCell(new Label(8, mmKaishihang,mmjieguo,wcfFCt));
                }else{
                    wsheet.addCell(new Label(8, mmKaishihang,mmjieguo,wcfFCb));
                }

                mmKaishihang = mmKaishihang+1;


            }
            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void baofeihuizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                 HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        int mmtongguoshu=mmYltpXiangmu.getTongguoshu();
       /* List<YltpBaofei> mmList=ddYltpbaofeiService.findBaofeilist(ppxiangmuid);*/
        List<Map<String, Object>> mmList=ddYltpbaofeiService.findByXiangmuId(ppxiangmuid);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = mmxiangmuname+"表决结果"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,500); //第一行高度
            wsheet.setRowView(1,500); //第一行高度
            wsheet.mergeCells(0, 0, 9, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,6); //宽度
            wsheet.setColumnView(1,22); //宽度
            wsheet.setColumnView(2,26); //宽度
            wsheet.setColumnView(3,15); //宽度
            wsheet.setColumnView(4,10); //宽度
            wsheet.setColumnView(5,6); //宽度
            wsheet.setColumnView(6,30); //宽度
            wsheet.setColumnView(7,12); //宽度
            wsheet.setColumnView(8,16); //宽度
            wsheet.setColumnView(9,10); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议时间："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 2, 1);


            wsheet.addCell(new Label(7, 1, "单位：万元",wcfFC2));
            wsheet.mergeCells(7, 1, 8, 1);

            wsheet.addCell(new Label(0, 2, "序号",wcfFC));
            wsheet.addCell(new Label(1, 2, "使用科室",wcfFC));
            wsheet.addCell(new Label(2, 2, "设备名称",wcfFC));
            wsheet.addCell(new Label(3, 2, "规格型号",wcfFC));
            wsheet.addCell(new Label(4, 2, "设备价值",wcfFC));
            wsheet.addCell(new Label(5, 2, "数量",wcfFC));
            wsheet.addCell(new Label(6, 2, "生产厂商",wcfFC));
            wsheet.addCell(new Label(7, 2, "采购时间",wcfFC));
            wsheet.addCell(new Label(8, 2, "投票结果",wcfFC));
            wsheet.addCell(new Label(9, 2, "表决结果",wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 9,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int mmKaishihang=3;

            for(int i=0;i<mmList.size();i++){
                Map<String,Object> mmMap=mmList.get(i);
                String mmXuhao = String.valueOf(i + 1);
                String mmshiyongkeshi=mmMap.get("shiyongkeshi")==null ? "" :mmMap.get("shiyongkeshi").toString();
                String mmshebeimingcheng=mmMap.get("shebeimingcheng")==null ? "" :mmMap.get("shebeimingcheng").toString();
                String mmguigexinghao=mmMap.get("guigexinghao")==null ? "" :mmMap.get("guigexinghao").toString();
                String mmshebeijiazhi=mmMap.get("sbjz")==null ? "" :mmMap.get("sbjz").toString();
                String mmshuliang=mmMap.get("shuliang")==null ? "" :mmMap.get("shuliang").toString();
                String mmshengchanchangshang=mmMap.get("shengchanchangshang")==null ? "" :mmMap.get("shengchanchangshang").toString();
                String mmlaiyuan=mmMap.get("laiyuan")==null ? "" :mmMap.get("laiyuan").toString();
                String mmcaigoushijian=mmMap.get("cgsj")==null ? "" :mmMap.get("cgsj").toString();
                String mmdetailId=mmMap.get("id")==null ? "" :mmMap.get("id").toString();
                int mmtoupiaoshu=ddService.getCountBydetailIdandResult(mmdetailId,"1");
                int mmzongshu=mmUserList.size();

                String mmpiaoshu="投票数"+mmtoupiaoshu+"/总数"+mmzongshu;

                String mmjieguo="";
                if(mmtoupiaoshu>=mmtongguoshu){
                    mmjieguo="通过";
                }else {
                    mmjieguo="不通过";
                }

                wsheet.addCell(new Label(0, mmKaishihang,mmXuhao,wcfFC));
                wsheet.addCell(new Label(1, mmKaishihang, mmshiyongkeshi,wcfFC));
                wsheet.addCell(new Label(2, mmKaishihang,mmshebeimingcheng,wcfFC));
                wsheet.addCell(new Label(3, mmKaishihang,mmguigexinghao,wcfFC));
                wsheet.addCell(new Label(4, mmKaishihang,mmshebeijiazhi,wcfFC));
                wsheet.addCell(new Label(5, mmKaishihang,mmshuliang,wcfFC));
                wsheet.addCell(new Label(6, mmKaishihang,mmshengchanchangshang,wcfFC));
                wsheet.addCell(new Label(7, mmKaishihang,mmcaigoushijian,wcfFC));
                wsheet.addCell(new Label(8, mmKaishihang,mmpiaoshu,wcfFC));
                wsheet.addCell(new Label(9, mmKaishihang,mmjieguo,wcfFC));
                mmKaishihang = mmKaishihang+1;


            }
            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void dailiangchuangxinhuizongbiao(@RequestParam("xiangmuid") String ppxiangmuid,
                                  HttpServletRequest request, HttpServletResponse response){

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");

        YltpXiangmu mmYltpXiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        List<Dailiangchuangxin> mmList=ddDailiangchuangxinService.finddailiangchuangxinlist(ppxiangmuid);

        YltpXiangmu mmxiangmu=ddYltpXiangmuService.findOne(ppxiangmuid);
        String mmxiangmuname=mmxiangmu.getXiangmuname();

        List<Map<String, Object>> mmUserList=ddYltprenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuid);

        OutputStream os=null;
        WritableWorkbook wbook=null;
        try
        {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = mmxiangmuname+ "汇总表"; //文件名
            String tmptitle = "《东部战区总医院医用耗材供应目录》投票表决表（" + mmxiangmuname + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename="+new String(wenjiantitle.getBytes(),"iso8859-1")+".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 20,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label=new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat=new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.setRowView(0,500); //第一行高度
            wsheet.setRowView(1,500); //第一行高度
            wsheet.setRowView(2,500); //第一行高度
            wsheet.mergeCells(0, 0, 12, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0,14); //宽度
            wsheet.setColumnView(1,5); //宽度
            wsheet.setColumnView(2,13); //宽度
            wsheet.setColumnView(3,13); //宽度
            wsheet.setColumnView(4,12); //宽度
            wsheet.setColumnView(5,11); //宽度
            wsheet.setColumnView(6,10); //宽度
            wsheet.setColumnView(7,10); //宽度
            wsheet.setColumnView(8,9); //宽度
            wsheet.setColumnView(9,9); //宽度
            wsheet.setColumnView(10,9); //宽度
            wsheet.setColumnView(11,10); //宽度
            wsheet.setColumnView(12,10); //宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2.setAlignment(Alignment.LEFT);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "会议日期："+StringHandle.shorttiemString(),wcfFC2));
            wsheet.mergeCells(0, 1, 5, 1);

            wsheet.addCell(new Label(0, 2, "带量批次",wcfFC));
            wsheet.addCell(new Label(1, 2, "序号",wcfFC));
            wsheet.addCell(new Label(2, 2, "产品分类",wcfFC));
            wsheet.addCell(new Label(3, 2, "中标编码",wcfFC));
            wsheet.addCell(new Label(4, 2, "产品名称",wcfFC));
            wsheet.addCell(new Label(5, 2, "产品规格",wcfFC));
            wsheet.addCell(new Label(6, 2, "产品型号",wcfFC));
            wsheet.addCell(new Label(7, 2, "注册证号",wcfFC));
            wsheet.addCell(new Label(8, 2, "生产厂家",wcfFC));
            wsheet.addCell(new Label(9, 2, "单位",wcfFC));
            wsheet.addCell(new Label(10, 2, "单价/元",wcfFC));
            wsheet.addCell(new Label(11, 2, "投票结果",wcfFC));
            wsheet.addCell(new Label(12, 2, "表决结果",wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 10,WritableFont.NO_BOLD,false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int mmKaishihang=3;

            for(int i=0;i<mmList.size();i++){
                Dailiangchuangxin mmDailiangchuangxin=mmList.get(i);
                String mmDailiangpici=mmDailiangchuangxin.getDailiangpici()==null ? "" :mmDailiangchuangxin.getDailiangpici();
                String mmXuhao=mmDailiangchuangxin.getOrdernumber()==null ? "" : String.valueOf(mmDailiangchuangxin.getOrdernumber());
                String mmChanpinfenlei=mmDailiangchuangxin.getChanpinfenlei()==null ? "" :mmDailiangchuangxin.getChanpinfenlei();
                String mmZhongbiaobianma=mmDailiangchuangxin.getZhongbiaobianma()==null ? "" :mmDailiangchuangxin.getZhongbiaobianma();
                String mmChanpinmingcheng=mmDailiangchuangxin.getChanpinmingcheng()==null ? "" :mmDailiangchuangxin.getChanpinmingcheng();
                String mmChanpinguige=mmDailiangchuangxin.getChanpinguige()==null ?"":mmDailiangchuangxin.getChanpinguige();
                String mmChanpinxinghao=mmDailiangchuangxin.getChanpinxinghao()==null ?"":mmDailiangchuangxin.getChanpinxinghao();
                String mmZhecezhenghao=mmDailiangchuangxin.getZhecezhenghao()==null ? "" :mmDailiangchuangxin.getZhecezhenghao();
                String mmShengchanchangjia=mmDailiangchuangxin.getShengchanchangjia()==null ? "" :mmDailiangchuangxin.getShengchanchangjia();
                String mmDanwei=mmDailiangchuangxin.getDanwei()==null ? "" :mmDailiangchuangxin.getDanwei();
                String mmDanjia=mmDailiangchuangxin.getDanjia()==null ? "" :mmDailiangchuangxin.getDanjia();
                String mmdetailId=mmDailiangchuangxin.getId()==null ? "" :mmDailiangchuangxin.getId();
                int mmtoupiaoshu=ddService.getCountBydetailIdandResult(mmdetailId,"1");
                int mmzongshu=mmUserList.size();



                String mmpiaoshu = "投票数"+mmtoupiaoshu+"/总数"+mmzongshu;

                String mmjieguo;
                double mmtongguoshu = 2 / 3 * mmzongshu;
                if(mmtoupiaoshu>mmtongguoshu){
                    mmjieguo="通过";
                }else {
                    mmjieguo="不通过";
                }
                wsheet.setRowView(mmKaishihang, 960);
                wsheet.addCell(new Label(0, mmKaishihang,mmDailiangpici,wcfFC));
                wsheet.addCell(new Label(1, mmKaishihang, mmXuhao,wcfFC));
                wsheet.addCell(new Label(2, mmKaishihang,mmChanpinfenlei,wcfFC));
                wsheet.addCell(new Label(3, mmKaishihang,mmZhongbiaobianma,wcfFC));
                wsheet.addCell(new Label(4, mmKaishihang,mmChanpinmingcheng,wcfFC));
                wsheet.addCell(new Label(5, mmKaishihang,mmChanpinguige,wcfFC));
                wsheet.addCell(new Label(6, mmKaishihang,mmChanpinxinghao,wcfFC));
                wsheet.addCell(new Label(7, mmKaishihang,mmZhecezhenghao,wcfFC));
                wsheet.addCell(new Label(8, mmKaishihang,mmShengchanchangjia,wcfFC));
                wsheet.addCell(new Label(9, mmKaishihang,mmDanwei,wcfFC));
                wsheet.addCell(new Label(10, mmKaishihang,mmDanjia,wcfFC));
                wsheet.addCell(new Label(11, mmKaishihang,mmpiaoshu,wcfFC));
                wsheet.addCell(new Label(12, mmKaishihang,mmjieguo,wcfFC));
                mmKaishihang = mmKaishihang+1;


            }
            wbook.write(); // 写入文件
            wbook.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }finally{
            if(os!=null){
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public static <T> Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor) {
        Map<Object, Boolean> seen = new ConcurrentHashMap<>();
        return object -> seen.putIfAbsent(keyExtractor.apply(object), Boolean.TRUE) == null;
    }

    public List<Map<String, Object>> findBiaojuelist(String mmxiangmuId, String mmxiangmuleixing, String mmuserId) {
        return  ddMapper.findBiaojuelist(mmxiangmuId, Tablename.getTablename(mmxiangmuleixing), mmuserId);
    }
    public List<Map<String, Object>> findlist(String mmxiangmuId, String tablename) {
        return  ddMapper.findlist(mmxiangmuId, tablename);
    }
    public Map<String, Integer> getVoteCount(String ppxiangmuId, String ppxiangmuleixing) {
        Map<String,Integer> map=new HashMap<>();
        Integer pinguiCount = ddMapper.getVoteCount(ppxiangmuId, Tablename.getTablename(ppxiangmuleixing));

        map.put("pinguiCount",pinguiCount);
        return map;
    }

    public void batchAddOrUpdate(List<YltpJieguo> mmaddList,List<YltpJieguo> mmupdateList) {

        List<YltpJieguo> addList = new ArrayList<>();
        List<YltpJieguo> updateList = new ArrayList<>();
        addList.addAll(mmaddList);
        updateList.addAll(mmupdateList);
        if (!addList.isEmpty()) {
            // 批量插入
            this.insertBatchThRead(addList);
        }
        if (!updateList.isEmpty()) {
            // 批量更新
            this.updateBatchThRead(updateList);
        }
    }
    /**
     * Desc:
     * 批量插入数据
     *
     * @return
     */
    public void insertBatchThRead(List<YltpJieguo> recordList) {
        // 一个线程处理500条数据
        int count = 500;
        // 数据集合大小
        int listSize = recordList.size();
        // 开启的线程数
        int runSize = (listSize / count) + 1;
        // 存放每个线程的执行数据
        List<YltpJieguo> newList = null;
        // 创建一个线程池，数量和开启线程的数量一样
        ExecutorService executor = Executors.newFixedThreadPool(runSize);
        // 创建两个个计数器
        CountDownLatch begin = new CountDownLatch(1);
        CountDownLatch end = new CountDownLatch(runSize);

        //开启的线程同时开始
        begin.countDown();
        for (int i = 0; i < runSize; i++) {
            /* 计算每个线程执行的数据 */
            if ((i + 1) == runSize) {
                int startIdx = (i * count);
                int endIdx = recordList.size();
                newList = recordList.subList(startIdx, endIdx);
            } else {
                int startIdx = (i * count);
                int endIdx = (i + 1) * count;
                newList = recordList.subList(startIdx, endIdx);
            }
            BatchInsertBankRecordThread thread = new
                    BatchInsertBankRecordThread(newList, begin, end,ddMapper );
            executor.execute(thread);
        }
        try {
            end.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        executor.shutdown();
    }
    public void updateBatchThRead(List<YltpJieguo> recordList) {
        // 一个线程处理500条数据
        int count = 500;
        // 数据集合大小
        int listSize = recordList.size();
        // 开启的线程数
        int runSize = (listSize / count) + 1;
        // 存放每个线程的执行数据
        List<YltpJieguo> newList = null;
        // 创建一个线程池，数量和开启线程的数量一样
        ExecutorService executor = Executors.newFixedThreadPool(runSize);
        // 创建两个个计数器
        CountDownLatch begin = new CountDownLatch(1);
        CountDownLatch end = new CountDownLatch(runSize);

        //开启的线程同时开始
        begin.countDown();
        for (int i = 0; i < runSize; i++) {
            /* 计算每个线程执行的数据 */
            if ((i + 1) == runSize) {
                int startIdx = (i * count);
                int endIdx = recordList.size();
                newList = recordList.subList(startIdx, endIdx);
            } else {
                int startIdx = (i * count);
                int endIdx = (i + 1) * count;
                newList = recordList.subList(startIdx, endIdx);
            }
            BatchupdateBankRecordThread thread = new
                    BatchupdateBankRecordThread(newList, begin, end,ddMapper );
            executor.execute(thread);
        }
        try {
            end.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        executor.shutdown();
    }


}
